美文网首页iOS动画特效iOS
iOS UIButton点击放大缩小效果动画

iOS UIButton点击放大缩小效果动画

作者: Long_iOS | 来源:发表于2022-10-18 16:00 被阅读0次
    + (void)buttonAnimationClick:(UIButton*)button{
        button.transform = CGAffineTransformIdentity;
        [UIView animateKeyframesWithDuration:0.5 delay:0 options:0 animations: ^{
            [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1 / 3.0 animations: ^{
                
                button.transform = CGAffineTransformMakeScale(1.1, 1.1);
            }];
            [UIView addKeyframeWithRelativeStartTime:1/3.0 relativeDuration:1/3.0 animations: ^{
                
                button.transform = CGAffineTransformMakeScale(0.8, 0.8);
            }];
            [UIView addKeyframeWithRelativeStartTime:2/3.0 relativeDuration:1/3.0 animations: ^{
                
                button.transform = CGAffineTransformMakeScale(1.0, 1.0);
            }];
        } completion:nil];
    }
    

    相关文章

      网友评论

        本文标题:iOS UIButton点击放大缩小效果动画

        本文链接:https://www.haomeiwen.com/subject/lbwezrtx.html