第十七章 Autorotation, Popover Controllers, and Modal View Controllers翻译
2016-05-18 15:34
363 查看
一,你可以为应用定制每个方向的布局
二,Autorotation
1,有device orientation和 interface orientation2种,取它们的插值得到可以支持的旋转方向
2,device orientaion代表设备的当前旋转方向,可以通过UIDevice的orientation进行获取
3,interface orientation代表页面的当前旋转方向,可以重载supportedInterfaceOrientations方法,它只能设置rootviewcontroller和present viewcontroller的方向,
无法直接设置其他的viewcontroller
三,Rotation Notification
1,在旋转方向改变的时候,应用会收到通知
willAnimateRotationToInterfaceOrientation:duration:.; 你可以在这个方法中定制view布局
2,可以通过interfaceOrientation.获取当前viewController的方向
3,Android的广播主要是用于进程间通信,它主要是基于观察者模式,发送的广播同样会作为一种事件加入到消息循环中;
在ios中引用处理旋转时,当收到系统发送的事件后,在程序内部进程中以广播的方式发送广播(为什么要发送广播,因为可能有多个组件监听这个事件)
四,UIPopoverController显示浮动框
1,可以移动的窗口?
2,只在IPad设备上支持
3,在popover中添加controller
4,popover消失处理
它的delegate会收到popoverControllerDidDismissPopover:消息;
五,More Modal View Controllers
1,可以以modally的方式显示一个view controller
2,显示:presentViewController
3,消失:dismissViewControllerAnimated
4,可以使用presentingViewController获取对应的present它的view controller
5,一般用于2个不相关的控制器之间的切换
六,block 函数指针
某些情况下,需要在某些方法中添加额外的回调:
此时可以创建一个block对象,即相当于c中的函数指针
1,可以使用快捷方式创建 ^ { }
六,线程安全单实例模式
七,view controller之间的关系
1,可以用于页面之间的跳转,所以非常重要
2,container - child之间的关系
container维护一个堆栈,viewcontrollers;
child可以通过parentviewcontroller获取上一级的view controller;
3,presented presenting之间的关系
可以通过presentedViewController获取present的view controller;
可以通过presentingViewController获取是谁present;
4,presentingViewController的值都是最顶部的view controller和哪一个发布的没关系
5,view controller family之间无法使用tabBarController、navigationController等property访问
二,Autorotation
1,有device orientation和 interface orientation2种,取它们的插值得到可以支持的旋转方向
2,device orientaion代表设备的当前旋转方向,可以通过UIDevice的orientation进行获取
3,interface orientation代表页面的当前旋转方向,可以重载supportedInterfaceOrientations方法,它只能设置rootviewcontroller和present viewcontroller的方向,
无法直接设置其他的viewcontroller
三,Rotation Notification
1,在旋转方向改变的时候,应用会收到通知
willAnimateRotationToInterfaceOrientation:duration:.; 你可以在这个方法中定制view布局
2,可以通过interfaceOrientation.获取当前viewController的方向
3,Android的广播主要是用于进程间通信,它主要是基于观察者模式,发送的广播同样会作为一种事件加入到消息循环中;
在ios中引用处理旋转时,当收到系统发送的事件后,在程序内部进程中以广播的方式发送广播(为什么要发送广播,因为可能有多个组件监听这个事件)
四,UIPopoverController显示浮动框
1,可以移动的窗口?
2,只在IPad设备上支持
3,在popover中添加controller
self.imagePickerPopover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
4,popover消失处理
它的delegate会收到popoverControllerDidDismissPopover:消息;
五,More Modal View Controllers
1,可以以modally的方式显示一个view controller
2,显示:presentViewController
3,消失:dismissViewControllerAnimated
4,可以使用presentingViewController获取对应的present它的view controller
5,一般用于2个不相关的控制器之间的切换
六,block 函数指针
某些情况下,需要在某些方法中添加额外的回调:
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion;
此时可以创建一个block对象,即相当于c中的函数指针
1,可以使用快捷方式创建 ^ { }
^{ [self.tableView reloadData]; };
六,线程安全单实例模式
static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedStore = [[self alloc] initPrivate]; });
七,view controller之间的关系
1,可以用于页面之间的跳转,所以非常重要
2,container - child之间的关系
container维护一个堆栈,viewcontrollers;
child可以通过parentviewcontroller获取上一级的view controller;
3,presented presenting之间的关系
可以通过presentedViewController获取present的view controller;
可以通过presentingViewController获取是谁present;
4,presentingViewController的值都是最顶部的view controller和哪一个发布的没关系
5,view controller family之间无法使用tabBarController、navigationController等property访问
相关文章推荐
- 为Linux主机用户设定特定的磁盘空间大小——Ubuntu12.04配置磁盘限额实战配置
- JavaCC -- Linux安装与使用
- MKMapSnapshotOptions生成地图快照
- docker 私有 registry 透过 nginx 反向代理
- openproj不能修改日期的原因分析与解决
- 如何利用github搭建一个个人网站
- tomcat同时存在多个项目webapp.root问题
- ecshop 支付
- Eclipse 启动tomcat报错java.lang.OutOfMemoryError: PermGen space 的解决方法
- sysbench测试linux I/O算法性能
- linux下DNS服务器视图view及日志系统详解
- RunLoop是什么?
- 写给刚毕业参加工作的朋友~张润萌
- Xshell带领用户访问远程服务器教程
- linux 磁盘挂载和卸载机制
- nginx变量使用方法详解(6)
- CentOS中vsftp安装与配置
- 在tomcat中,通过IP访问web系统,不需要端口号的方法(转)
- Linux下rz/sz安装及使用方法
- in a devstack Openstack env, how to start a service, such as aodh-listener