iOS - 模态视图跳转添加动画的两种方式
2017-04-12 本文已影响0人
Immensity_G
第一种
ModalViewController * modalView = [[ModalViewController alloc]init];
modalView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:modalView animated:YES completion:nil];
typedef NS_ENUM(NSInteger, UIModalTransitionStyle) {
UIModalTransitionStyleCoverVertical = 0,//默认垂直向上
UIModalTransitionStyleFlipHorizontal, 翻转效果
UIModalTransitionStyleCrossDissolve,淡入淡出
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
UIModalTransitionStylePartialCurl,翻页效果
#endif
};
第二种
CATransition *animate =[CATransition getAnimation:1];
[[[[UIApplication sharedApplication] keyWindow] layer] addAnimation:animate forKey:nil];
[self presentViewController:rootVC animated:NO completion:^{
}];