iOS iOS8新特性--UIPresentationController
2015-02-07 23:10
561 查看
1. UIPresentationController的作用
1>管理所有Modal出来的控制器2>管理通过这个方法 - (void) presentViewController:(UIViewController *) animated:(BOOL) completion:^(void)completion;显示出来的控制器
3>管理\监听 切换控制器的过程
2. UIPresentationController的作用
1>控制器一旦调了present方法,控制器的presentationController,会先创建好了,然后整个控制器的切换由presentationController管理- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
SecondViewController *vc = [[SecondViewController alloc]init];
[self presentViewController:vc animated:YES completion:nil];
}
2>控制器有2个属性:presentationController和poppverPresentationController
下面的截图场景 vc.modalPresentationStyle = UIModalPresentationFormSheet, 这种情况下poppverPresentationController = nil
3>设置控制器以popver的方式切换.
也就是说 vc.modalPresentationStyle = UIModalPresentationPopover,控制器的popoverPresentationController属性就不再是nil了
而且popoverPresentationController 和 presentationController 指向同一对象,指向的都是 UIPopoverPresentationController 类对象
注: 1>UIPopoverPresentationController类 继承自 UIPresentationController类
2>父类指针可以指向子类,所以presentationController指向UIPopoverPresentationController对象,没有问题
4>控制器的presentationController 和 popoverPresentationController采用的是懒加载的方式,下面这段代码,vc控制器是不会popover出来的.
SecondViewController *vc = [[SecondViewController alloc]init];
// 在 vc.popoverPresentationController.sourceView = self.segmented之前调了presentationController的get方法
vc.presentationController;
vc.modalPresentationStyle = UIModalPresentationPopover;
vc.popoverPresentationController.sourceView = self.segmented;
[self presentViewController:vc animated:YES completion:nil];
相关文章推荐
- iOS iOS8新特性--UIPopoverPresentationController
- 【学习ios之路:UI系列】(UISearchBar,UISearchDisplayController) 和UISearchController(iOS8新特性)
- iOS:自定义模态动画 --UIPresentationController
- iOS UISplitViewController 开发(iOS8)
- iOS8新特性(1)-UIPopoverPresentationController使用
- iOS8新特性UIAlertViewController,UISearchController,UIPopoverPresentationController,WKWebView
- 【iOS】iOS8 与以前版本比较,添加的新特性
- iOS 7 UI Transition – Porting View Controller Layouts from iOS 6
- iOS 利用UIDocumentInteractionController打开和预览文档
- IOS学习笔记35——UIPasteboard/UIMenuController(一)
- iOS8新特性之基于地理位置的消息通知UILocalNotification
- IOS 7新特性--UIDatePicker
- ios之UISplitViewController
- iOS 6新特性UIActivityViewController使用教程(一)
- iOS ios8新特性之扩展
- iOS ios8新特性之扩展详解
- iOS 7 新特性之ViewController切换
- IOS开发:导航控制器UINavigationController和选项卡栏控制器UI...
- iOS 6新特性UIActivityViewController使用教程(一)
- IOS学习笔记37——UIPasteboard/UIMenuController(三)