在此动画中:
- (void)ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
self.isTouchEnabled = NO;
if (scoreLabel.opacity == 225) {
NSLog(@"fadeOut");
CCSequence *fadeOut = [CCSequence actions:[CCFadeOut actionWithDuration:0.5], [CCCallFuncN actionWithTarget:self
selector:@selector(enableTouches)], nil];
[scoreLabel runAction:fadeOut];
[livesLabel runAction:[[fadeOut copy] autorelease]];
}
else {
NSLog(@"fadeIn");
CCSequence *fadeIn = [CCSequence actions:[CCFadeIn actionWithDuration:0.5], [CCCallFuncN actionWithTarget:self
selector:@selector(enableTouches)], nil];
[scoreLabel runAction:fadeIn];
[livesLabel runAction:[[fadeIn copy] autorelease]];
}
}
我试图简单地淡出/淡入标签。但问题是,我想确保在标签动画时不会调用此方法。
如果您查看代码,我会尝试通过调用此方法来做到这一点:
- (void)enableTouches {
NSLog(@"ET");
self.isTouchEnabled = YES;
}
但这似乎不起作用。如果我在标签动画时触摸屏幕,它会在中途弄乱动画并且不会做我想要的。
有任何想法吗?
谢谢!