你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> 自己寫的動畫函數,方便啊

自己寫的動畫函數,方便啊

編輯:關於IOS

 

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

 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved