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

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

伊谢尔伦
伊谢尔伦

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

répondre à tous(3)
迷茫

Il n'existe aucune API pertinente permettant de déterminer si l'animation est en cours d'exécution. Il existe uniquement la méthode suivante, qui peut être déterminée en jugeant 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;
    
}
伊谢尔伦

Personnellement, il est préférable d'utiliser l'attribut bool de label pour enregistrer

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!