自己写的动画函数,方便啊

来源:互联网 发布:java gzip 压缩文件 编辑:程序博客网 时间:2024/06/05 18:39




-(void)UIViewAnimation:(UIView* )view

                 frame:(CGRect)frame

                  type:(int)type

                 alpha:(float)alpha

              duration:(float)duration

{

    [UIViewbeginAnimations:nilcontext:nil];

    [UIViewsetAnimationDuration:duration];

    [UIViewsetAnimationCurve:type];

    [UIViewsetAnimationDelegate:self];

    view.alpha=alpha;

    view.frame=frame;

    [UIViewcommitAnimations];

}


调用方法

[selfUIViewAnimation:downViewframe:CGRectMake(0, height,320, 58) type:UIViewAnimationCurveEaseOutalpha:1duration:0.3];


downView是你要实现动画的视图

CGRectMake(0, height, 32058)位置变换

UIViewAnimationCurveEaseOut 动画效果  


还有如下: 

    UIViewAnimationCurveEaseInOut,        // slow at beginning and end

    UIViewAnimationCurveEaseIn,           // slow at beginning

    UIViewAnimationCurveEaseOut,          // slow at end

    UIViewAnimationCurveLinear


1 透明度更改

0.3 动画时间


原创粉丝点击