-(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 動畫時間