标签:
在iPad上modal有四种切换方式,分别是竖直进入(由下到上,默认方式)、水平翻转、淡入淡出。
属性要设置在将要modal出来的控制器上:
/* typedef NS_ENUM(NSInteger, UIModalTransitionStyle) { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, UIModalTransitionStylePartialCurl NS_ENUM_AVAILABLE_IOS(3_2), }; */ // 注意iOS7翻页(UIModalTransitionStylePartialCurl)只能漏出下面控制器的一部分,注意翻页只能在控制器全屏显示时使用。 vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
/* typedef NS_ENUM(NSInteger, UIModalPresentationStyle) { UIModalPresentationFullScreen = 0, UIModalPresentationPageSheet NS_ENUM_AVAILABLE_IOS(3_2), UIModalPresentationFormSheet NS_ENUM_AVAILABLE_IOS(3_2), UIModalPresentationCurrentContext NS_ENUM_AVAILABLE_IOS(3_2), UIModalPresentationCustom NS_ENUM_AVAILABLE_IOS(7_0), UIModalPresentationOverFullScreen NS_ENUM_AVAILABLE_IOS(8_0), UIModalPresentationOverCurrentContext NS_ENUM_AVAILABLE_IOS(8_0), UIModalPresentationPopover NS_ENUM_AVAILABLE_IOS(8_0), UIModalPresentationNone NS_ENUM_AVAILABLE_IOS(7_0) = -1, };*/ // PageSheet宽度固定为768,高度为当前屏幕高度 // FormSheet在中央显示一小块,常用,注意和popover区分。 vc.modalPresentationStyle = UIModalPresentationFormSheet;modal的方式还是原来的方法, 并且dismiss时按照设定的方式退出。
[self presentViewController:vc animated:YES completion:nil];
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ ViewController2 *vc = [[ViewController2 alloc] init]; vc.view.backgroundColor = [UIColor redColor]; /* typedef NS_ENUM(NSInteger, UIModalTransitionStyle) { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, UIModalTransitionStylePartialCurl NS_ENUM_AVAILABLE_IOS(3_2), }; */ // 注意iOS7翻页(UIModalTransitionStylePartialCurl)只能漏出下面控制器的一部分,注意翻页只能在控制器全屏显示时使用。 vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical; /* typedef NS_ENUM(NSInteger, UIModalPresentationStyle) { UIModalPresentationFullScreen = 0, UIModalPresentationPageSheet NS_ENUM_AVAILABLE_IOS(3_2), UIModalPresentationFormSheet NS_ENUM_AVAILABLE_IOS(3_2), UIModalPresentationCurrentContext NS_ENUM_AVAILABLE_IOS(3_2), UIModalPresentationCustom NS_ENUM_AVAILABLE_IOS(7_0), UIModalPresentationOverFullScreen NS_ENUM_AVAILABLE_IOS(8_0), UIModalPresentationOverCurrentContext NS_ENUM_AVAILABLE_IOS(8_0), UIModalPresentationPopover NS_ENUM_AVAILABLE_IOS(8_0), UIModalPresentationNone NS_ENUM_AVAILABLE_IOS(7_0) = -1, };*/ // PageSheet宽度固定为768,高度为当前屏幕高度 // FormSheet在中央显示一小块,常用,注意和popover区分。 vc.modalPresentationStyle = UIModalPresentationFormSheet; [self presentViewController:vc animated:YES completion:nil];
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/xyt8023y/article/details/47278013