当前位置:编程学习 > wap >>

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

 

-(void)UIViewAnimation:(UIView* )view

                 frame:(CGRect)frame

                  type:(int)type

                 alpha:(float)alpha

              duration:(float)duration

{

    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationDuration:duration];

    [UIView setAnimationCurve:type];

    [UIView setAnimationDelegate:self];

    view.alpha=alpha;

    view.frame=frame;

    [UIView commitAnimations];

}

 

调用方法


[self UIViewAnimation:downView frame:CGRectMake(0, height, 320, 58) type:UIViewAnimationCurveEaseOut alpha:1 duration:0.3];

 

downView是你要实现动画的视图


CGRectMake(0, height, 320, 58)位置变换


UIViewAnimationCurveEaseOut 动画效果 

 


还有如下:

    UIViewAnimationCurveEaseInOut,         // slow at beginning and end

    UIViewAnimationCurveEaseIn,            // slow at beginning

    UIViewAnimationCurveEaseOut,           // slow at end

    UIViewAnimationCurveLinear

 

1 透明度更改


0.3 动画时间


 

补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,