Heim > Fragen und Antworten > Hauptteil
迷茫2017-04-18 09:33:36
没有找到能判断是否正在执行动画的相关的API,只有下面的方法,通过判断isAnimating 来判断
// 设置初始值(最好使用全局或者属性)
__block BOOL isAnimating =YES;
self.transform = CGAffineTransformMakeScale(6, 6);
[UIView animateKeyframesWithDuration:0.333 delay:0 options:0 animations:^{
self.transform = CGAffineTransformMakeScale(1, 1);
} completion:^(BOOL finished) {
// 成功回调改为NO
isAnimating = NO;
completion();
}];
ringa_lee2017-04-18 09:33:36
-(BOOL)isAnimated
{
BOOL animated = self.layer.animationKeys.count > 0;
for (UIView *subView in self.subviews) {
animated |= subView.isAnimated;
}
return animated;
}