0
我创建一个动画的UIButton来模拟insterstitial旗帜,但它没有得到事件UIControlEventTouchUpInside。这里是我的代码:的Objective-C - 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;
}
有没有人知道什么是错的?
问候, 克劳迪奥
它的说法太:“在动画,用户交互暂时参与动画中的所有观点禁用无论在此属性的值,您可以通过配置动画时指定UIViewAnimationOptionAllowUserInteraction选项来禁用这种行为。”但仍然无法正常工作。一些想法? – Claudio 2012-04-19 18:36:36