Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 目标-C-UIControlEventTouchUpInside未触发?_Objective C_Uibutton - Fatal编程技术网

Objective c 目标-C-UIControlEventTouchUpInside未触发?

Objective c 目标-C-UIControlEventTouchUpInside未触发?,objective-c,uibutton,Objective C,Uibutton,我正在创建一个动画UIButton来模拟Insterstital横幅,但它没有将事件UIControlEventTouchUpInside。这是我的密码: -(void)insertInterstitialBannerAtView:(UIView *)mainView { if ([self bannerExists]) { bannerButton = [UIButton buttonWithType:UIButtonTypeCustom]; [bann

我正在创建一个动画UIButton来模拟Insterstital横幅,但它没有将事件UIControlEventTouchUpInside。这是我的密码:

-(void)insertInterstitialBannerAtView:(UIView *)mainView {
    if ([self bannerExists]) {
        bannerButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [bannerButton setFrame:CGRectMake(0, 480, 320, 43)];
        [bannerButton setImage:[UIImage imageNamed:@"389.png"] forState:UIControlStateNormal];
        [bannerButton setEnabled:YES];
        [mainView addSubview:bannerButton];
        [mainView bringSubviewToFront:bannerButton];
        [bannerButton addTarget:self 
                         action:@selector(buttonPushed) 
               forControlEvents:UIControlEventTouchUpInside];

        [UIView animateWithDuration:2.0 
                         animations:^(void) {
                             [bannerButton setFrame:CGRectMake(0, 417, 320, 43)];
                         } 
                         completion:^(BOOL finished) {
                             [UIView animateWithDuration:2.0 delay:3.0 options:UIViewAnimationTransitionNone animations:^(void){
                                 [bannerButton setFrame:CGRectMake(0, 480, 320, 43)];
                         } 
                                          completion:^(BOOL finished) {

                                          }];
        }];
    }
}

-(IBAction)buttonPushed{
    NSLog(@"Interstitial Pushed");
}

-(BOOL)bannerExists{
    BOOL returnValue = FALSE;
    NSArray *names = [URLFORSPLASH componentsSeparatedByString:@"/"];
    NSString *fileName = [names lastObject];
    NSString *cacheFolder = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
    NSString *filePath = [cacheFolder stringByAppendingPathComponent:fileName];
    if ([[NSFileManager defaultManager]fileExistsAtPath:filePath] ) {
        returnValue = TRUE;
    }
    return returnValue;
}
有人知道怎么了吗

问候,,
Claudio在动画中禁用交互。从UIView文档中:

在动画期间,将暂时禁用正在设置动画的视图的用户交互。在iOS 5之前,对整个应用程序禁用用户交互


如果您的目标是ios 5,您可能可以在父视图中截取触摸,然后检查它们是否在截取触摸时动画所在的位置。

它还说:在动画期间,动画中涉及的所有视图都会暂时禁用用户交互,不考虑此属性中的值。配置动画时,可以通过指定UIViewAnimationOptionAllowUserInteraction选项来禁用此行为。但仍然不起作用。有什么想法吗?