UIViewConroller(控制器)间关系
来源:互联网 发布:淘宝怎么看旺旺号 编辑:程序博客网 时间:2024/06/07 22:32
presentModalViewController:animated:The presentViewController:animated:completion: method is the preferred way to present a modal view as of iOS 5.0.
程序示例:(Context:self是嵌入在UINavigationController中的子控制器,)
//////////////////////////// Demo1 ////////////////////////////// UIViewController *vc = [[MyController alloc] init]; [self presentViewController:vc animated:YES completion:NULL]; NSLog(@"%@", self.presentedViewController); //MyController NSLog(@"%@", self.presentingViewController); NSLog(@"%@", self.parentViewController); //UINavigationController NSLog(@"%@", vc.presentedViewController); NSLog(@"%@", vc.presentingViewController); //UINavigationController NSLog(@"%@", vc.parentViewController);//////////////////////////// Demo1 ////////////////////////////// UIViewController *vc = [[MyController alloc] init];[self.navigationController pushViewController:vc animated:YES]; NSLog(@"%@", self.presentedViewController); NSLog(@"%@", self.presentingViewController); NSLog(@"%@", self.parentViewController); //UINavigationController NSLog(@"%@", vc.presentedViewController); NSLog(@"%@", vc.presentingViewController); NSLog(@"%@", vc.parentViewController);//UINavigationController
可见,控制器之间的关系有两种:
1.parent & child(父子,如,控制器容器UINavigationController和它的子控制器的关系)
2.presented &presenting (被呈现者,呈现者,就是被弹出的控制器和弹出这个控制器的控制器之间的关系)
注意:
由示例所示:如果一个控制器被一个在另一个控制器容器中的控制器弹出的时候,那么它的presenting ViewController就是那个控制器容器,而不是直接弹出它的那个控制器,这么设计的原因也许是因为使层次结(architecture)构简单吧。
0 0
- UIViewConroller(控制器)间关系
- UIViewConroller(控制器)间关系
- 通过UIView 获取父UIviewConroller(通过子视图获取父控制器)
- 添加视图控制器间的关系
- 浅谈iOS视图控制器间的关系
- springMVC中控制器的关系
- 13.控制器的父子关系
- iOS 导航控制器、导航条、导航项、控制器的关系
- iOS 抽屉效果实现 注意点 及 iOS 控制器间的父子关系 详解
- spring mvc 各种控制器的区别关系
- 视图生命周期与视图控制器关系
- iOS_21团购_控制器继承关系图
- IOS视图生命周期与视图控制器关系
- 通道、设备、设备控制器三者间关系
- IOS开发UI基础:控制器父子关系
- [IOS]创建控制器View的优先级关系
- iOS 控制器父子关系的建立原则
- 控制器父子关系的建立原则
- 085 Maximal Rectangle [Leetcode]
- leetcode 21_Merge Two Sorted Lists & leetcode_258 Add Digits & leetcode_66plus one
- hdu1796 How many integers can you find 容斥原理
- GDOI2016模拟8.16总结
- HBase介绍
- UIViewConroller(控制器)间关系
- 蓝桥杯练习:入门训练 Fibonacci数列
- 超详细!iOS 并发编程之 Operation Queues
- 【算法】字符串包含
- new,malloc区别
- MongoDB查询内嵌文档
- hdu 3509
- vijos - P1286座位安排 (DP状态压缩 + 组合数 + python)
- .NET平台调用(Win32 P/Invoke)