UIModalPresentationStyle和UIModalTransitionStyle
2015-06-24 09:40
555 查看
弹UIKit提供的一些专门用于模态显示的ViewController,如UIImagePickerController等。系统的模态视图主要是通过delegate来进行viewController之间的信息传递。
常见概念
1、presenting view controller and presented view controller
view controllerA 上模态显示view controllerB,A就相当于presenting view controller , B就相当于 presented
view controller。
Modal Presentation Styles(弹出风格)
通过设置presenting VC的modalPresentationStyle属性,我们可以设置弹出View Controller时的风格,有以下四种风格,其定义如下:
UIModalPresentationFullScreen代表弹出VC时,presented VC充满全屏,如果弹出VC的wantsFullScreenLayout设置为YES的,则会填充到状态栏下边,否则不会填充到状态栏之下。
UIModalPresentationPageSheet代表弹出是弹出VC时,presented VC的高度和当前屏幕高度相同,宽度和竖屏模式下屏幕宽度相同,剩余未覆盖区域将会变暗并阻止用户点击,这种弹出模式下,竖屏时跟 UIModalPresentationFullScreen的效果一样,横屏时候两边则会留下变暗的区域。
UIModalPresentationFormSheet这种模式下,presented VC的高度和宽度均会小于屏幕尺寸,presented VC居中显示,四周留下变暗区域。
UIModalPresentationCurrentContext这种模式下,presented VC的弹出方式和presenting VC的父VC的方式相同。
这四种方式在iPad上面统统有效,但在iPhone和iPod touch上面系统始终已UIModalPresentationFullScreen模式显示presented VC。
Modal Transition Style动画效果
通过设置设置presenting VC的modalTransitionStyle属性,我们可以设置弹出presented VC时场景切换动画的风格,其定义如下:
我们可以看到有从底部滑入,水平翻转进入,交叉溶解以及翻页这四种风格可选。这四种风格在不受设备的限制,即不管是iPhone还是iPad都会根据我们指定的风格显示转场效果。
常见概念
1、presenting view controller and presented view controller
view controllerA 上模态显示view controllerB,A就相当于presenting view controller , B就相当于 presented
view controller。
Modal Presentation Styles(弹出风格)
通过设置presenting VC的modalPresentationStyle属性,我们可以设置弹出View Controller时的风格,有以下四种风格,其定义如下:
typedef enum { UIModalPresentationFullScreen = 0, UIModalPresentationPageSheet, // ipad有效 UIModalPresentationFormSheet, // ipad有效 UIModalPresentationCurrentContext, // ipad有效 } UIModalPresentationStyle;
UIModalPresentationFullScreen代表弹出VC时,presented VC充满全屏,如果弹出VC的wantsFullScreenLayout设置为YES的,则会填充到状态栏下边,否则不会填充到状态栏之下。
UIModalPresentationPageSheet代表弹出是弹出VC时,presented VC的高度和当前屏幕高度相同,宽度和竖屏模式下屏幕宽度相同,剩余未覆盖区域将会变暗并阻止用户点击,这种弹出模式下,竖屏时跟 UIModalPresentationFullScreen的效果一样,横屏时候两边则会留下变暗的区域。
UIModalPresentationFormSheet这种模式下,presented VC的高度和宽度均会小于屏幕尺寸,presented VC居中显示,四周留下变暗区域。
UIModalPresentationCurrentContext这种模式下,presented VC的弹出方式和presenting VC的父VC的方式相同。
这四种方式在iPad上面统统有效,但在iPhone和iPod touch上面系统始终已UIModalPresentationFullScreen模式显示presented VC。
Modal Transition Style动画效果
通过设置设置presenting VC的modalTransitionStyle属性,我们可以设置弹出presented VC时场景切换动画的风格,其定义如下:
typedef enum { UIModalTransitionStyleCoverVertical = 0,//底部滑入 UIModalTransitionStyleFlipHorizontal, //水平翻转 UIModalTransitionStyleCrossDissolve, //教材溶解 UIModalTransitionStylePartialCurl, //翻页 } UIModalTransitionStyle;
我们可以看到有从底部滑入,水平翻转进入,交叉溶解以及翻页这四种风格可选。这四种风格在不受设备的限制,即不管是iPhone还是iPad都会根据我们指定的风格显示转场效果。
相关文章推荐
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- 我的iPhone桌面
- 三种检测iPhone/iPad设备方向的方法
- android Gallery组件实现的iPhone图片滑动效果实例
- Android仿iphone自定义滚动选择器
- 使用Objective-C获取IPHONE手机IMSI序列号
- 探讨Android 的屏幕滚动操作不如 iPhone 流畅顺滑的原因
- iphone的safari浏览器中实现全屏浏览的方法
- 无锡格瑞驰车业 ipad做汽车导航
- Object-c Archiving归档
- 西蒙iphone-OpenGL ES教程英文原帖地址以及实例代码
- [开源项目]开心英语8000句 Iphone+Ipad版
- 月光微博客
- 月光微博客
- 月光微博客
- 月光微博客
- 月光微博客
- 【51CTO学院】双11抽奖规则
- 【1.24-2.02】春节放"价",优惠无“假"——手机专享8折