vc present vc1 vc present vc2 vc present vc3 什么现象? 2019-07-03 13:20:50.876200+0800 vcpresentTest[3214:42279] Warning: Attempt to present <ViewController: 0x7fe27c510d70> on <duogepresentAndDimissFirstVc: 0x7fe27c5081e0> whose view is not in the window hierarchy! vc的view再也不window上 不能再present 别的vc了,只有得一个vc的present 的completion block调用,后面的completion block不会调用 最终页面显示vc1的viewbash
// [self presentViewController:vc1 animated:YES completion:nil];
// [self presentViewController:vc2 animated:YES completion:nil];
// [self presentViewController:vc3 animated:YES completion:nil];
[self presentViewController:vc1 animated:YES completion:^{
[self presentViewController:vc2 animated:YES completion:^{
//completion不会执行
[self presentViewController:vc3 animated:YES completion:nil];
}];
}];
复制代码
vc present vc1 vc1 present vc2 vc2 present vc3 vc dimiss 什么现象? vc2,vc3, 同时dealloc,页面直接回到第一个 vcapp
vc present vc1 vc1 dismiss vc1 dimiss vc1 dimiss 重复调用dimiss 什么现象? 只有第一个vc1 dimiss有效,其它的无做用;只有第一个vc的dimiss completion block执行,后面的dimiss completion block不会调用ide
// [self dismissViewControllerAnimated:YES completion:nil];
// [self dismissViewControllerAnimated:YES completion:nil];
// [self dismissViewControllerAnimated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:^{
[self dismissViewControllerAnimated:YES completion:^{
//completion不会执行
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"%s[%d]", __func__, __LINE__);
}];
}];
}];
复制代码
navvc present: tabvc,vc,navvc tabvc present: tabvc,vc,navvc vc present: tabvc,vc,navvc 都是OK的ui
navvc push: tabvc,vc,navvc push navvc:崩溃 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported' push tabvc:支持!!!this
The root view controller provides the content view of the window. Assigning a view controller to this property (either programmatically or using Interface Builder) installs the view controller’s view as the content view of the window. The new content view is configured to track the window size, changing as the window size changes. If the window has an existing view hierarchy, the old views are removed before the new ones are installed. The default value of this property is nil. 不会!spa
vc present vc1, vc1 present vc2, vc2 present vc3 全部旧的vc都不会dealloc 由于一层一层被root vc持有, root vc持有childvc方式、或者presented的方式code
vc2回到vc1rem
push进入或者pop返回 vc1 willDisappear -〉 vc2 willAppear -》vc1 DidDisappear -〉 vc2 DidAppearstring
present进入或dimiss返回 vc1 willDisappear -〉 vc2 willAppear -》vc2 DidAppear -〉vc1 DidDisappearit
对vc presentedViewController/presentingViewController 的影响 对navvc viewControllers的影响