【发布时间】:2013-04-18 01:43:47
【问题描述】:
给定以下代码
self.view.backgroundColor = [UIColor yellowColor];
MyViewController *myVC = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil]
myVC.view.backgroundColor = [UIColor clearColor];
myVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:myVC animated:NO completion:nil];
当我们调用 presentViewController 时,底层会发生什么?当 myVC 可见时,我看不到黄色,然后我在它的 viewDidAppear 方法中检查了 myVC.view.superView,它是 UIWindow。
Q1. 这是否意味着直到模态窗口启动为止,presentingViewController.view(在上述情况下为 self.view)从视图层次结构中移除,并从 presentingViewController.view(在上述情况下为 myVC.view)在 UIWindow 上添加?
Q2.如果 myVC.modalPresentationStyle != UIModalPresentationFullScreen 会怎样?
Q3. iOS 是否也会从 UIWindow 中删除除presentedViewController.view 之外的所有视图,直到全屏模式对话框进行优化?如果没有,为什么不呢?
【问题讨论】:
-
什么是
clippingVC?
标签: iphone ios objective-c ipad uiviewcontroller