我在一个UIView子类中有以下代码:
[element setAlpha: 0.0f];
[UIView animateWithDuration: 0.4 delay: 0.0 options: UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations: ^{
[element setAlpha: 1.0f];
} completion: ^(BOOL finished){
if (finished)
{
return;
}
}];
当我想停止动画时,我会向视图本身发送以下消息:
[[self layer] removeAllAnimations];
但它什么也没做... 我该如何停止动画?
#import <QuartzCore/QuartzCore.h>
- Malloc[self.layer removeAllAnimations];
,另外,请问您是否收到任何编译警告? - Mallocelement.layer
上调用removeAllAnimations
,而不是self.layer
,你认为呢? - neilco