使用首尾式動畫
大概有以下 API:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
self.iconBtn.bounds = bounds;
[UIView commitAnimations];
//[UIView setAnimationDuration:5.0];//設定持續時長
//[UIView setAnimationDelay:1.0];//設定延遲
// [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//設定動畫塊中的動畫屬性變化的曲線
/*
typedef NS_ENUM(NSInteger, UIViewAnimationCurve) {
UIViewAnimationCurveEaseInOut, // slow at beginning and end
UIViewAnimationCurveEaseIn, // slow at beginning
UIViewAnimationCurveEaseOut, // slow at end
UIViewAnimationCurveLinear
};
*/
//[UIView setAnimationRepeatAutoreverses:NO];//是否回複
//[UIView setAnimationRepeatCount:10];//重複次數
//[UIView setAnimationStartDate:(NSDate *)];//設定動畫開始運作的時間
//[UIView setAnimationDelegate:self];//設定代理
//[UIView setAnimationWillStartSelector:(SEL)];//設定動畫開始運動的執行方法
//[UIView setAnimationDidStopSelector:(SEL)];//設定動畫運作結束後的執行方法
還有一些進階動畫,可以實作動畫 翻轉、旋轉,偏移,翻頁,縮放,取反的動畫效果,後續!