ios - 如何判断CALayer正在做动画?
伊谢尔伦
伊谢尔伦 2017-04-18 09:31:36
0
3
396

场景:存在一个UILabel实例,对它做缩放,如何清除知道他正在缩放?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
迷茫

There is no relevant API that can determine whether animation is being executed. There is only the following method, which can be determined by judging 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;
    
}
伊谢尔伦

Personally, it’s best to record using the bool attribute of label

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!