iOS 动画

1,简单动画

        [UIView animateWithDuration:(NSTimeInterval) animations:^{
            <#code#>
        } completion:^(BOOL finished) {
            code
        }];


2,延时动画

        [UIView animateKeyframesWithDuration:(NSTimeInterval) delay:(NSTimeInterval) 
 options:(UIViewKeyframeAnimationOptions) animations:^{
            <#code#>
        } completion:^(BOOL finished) {
            code
        }];
delay表明延时的时间,单位是秒
UIViewKeyframeAnimationOptions经常使用:
//             UIViewAnimationOptionCurveEaseInOut            // default  快进快出
//             UIViewAnimationOptionCurveEaseIn               = 1 << 16,  快进
//             UIViewAnimationOptionCurveEaseOut              = 2 << 16,  快出
//             UIViewAnimationOptionCurveLinear                           匀速


3,transform

label.transform = CGAffineTransformMakeTranslation(0, label.height);
label.transform = CGAffineTransformIdentity;
 
 常配合二段动画(简单动画+延时动画)使用
 CGAffineTransformMakeTranslation               往坐标移动
 CGAffineTransformIdentity                      回归原位置
相关文章
相关标签/搜索