標籤:
直接源碼:
- (void) transitionWithType:(NSString *) type WithSubtype:(NSString *) subtype ForView : (UIView *) view
{
//建立CATransition對象
CATransition *animation = [CATransition animation];
//設定運動時間
animation.duration = 0.7f;
//設定運動type
animation.type = type;
if (subtype != nil) {
//設定子類
animation.subtype = subtype;
}
//設定運動速度
animation.timingFunction = UIViewAnimationOptionCurveEaseInOut;
[view.layer addAnimation:animation forKey:@"animation"];
}
把此方法粘貼後。就可以 思考你要啥 動畫了
typedef enum : NSUInteger {
Fade = 1, //淡入淡出
Push, //推擠
Reveal, //揭開
MoveIn, //覆蓋
Cube, //立方體
SuckEffect, //吮吸
OglFlip, //翻轉
RippleEffect, //波紋
PageCurl, //翻頁
PageUnCurl, //反翻頁
CameraIrisHollowOpen, //開鏡頭
CameraIrisHollowClose, //關鏡頭
CurlDown, //下翻頁
CurlUp, //上翻頁
FlipFromLeft, //左翻轉
FlipFromRight, //右翻轉
} AnimationType;
如果是在父類寫的此方法。子類直接調用。
[super transitionWithType:@"cude" WithSubtype:kCATransitionFromLeft ForView:self.navigationController.view];要啥 效果可以 自己嘗試。Fight.
iOS之push present 動畫