扫码关注官方订阅号
场景:存在一个UILabel实例,对它做缩放,如何清除知道他正在缩放?
小伙看你根骨奇佳,潜力无限,来学PHP伐。
没有找到能判断是否正在执行动画的相关的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(); }];
-(BOOL)isAnimated { BOOL animated = self.layer.animationKeys.count > 0; for (UIView *subView in self.subviews) { animated |= subView.isAnimated; } return animated; }
个人感觉 用label的bool属性记录最好
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
没有找到能判断是否正在执行动画的相关的API,只有下面的方法,通过判断isAnimating 来判断
个人感觉 用label的bool属性记录最好