佚名通过本文主要向大家介绍了切换跟控制器后。上一个控制器presentViewController子控制器的VIew还在。为什么?等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 切换跟控制器后。上一个控制器presentViewController子控制器的VIew还在。为什么?
描述:
解决方案1:
描述:
UIViewController *red = [[UIViewController alloc]init];
red.view.backgroundColor = [UIColor redColor];
//当前控制器 presentViewController 一个子控制器
[self presentViewController:red animated:YES completion:nil];
[UIApplication sharedApplication].keyWindow.rootViewController = [[ViewController alloc]init];
[[UIApplication sharedApplication].keyWindow sendSubviewToBack:[UIApplication sharedApplication].keyWindow.rootViewController.view];
//在 ViewController 加载完毕后。red.view也在window中。为什么没有伴随上一个控制器一起被销毁呢?
解决方案1:
[[UIApplication sharedApplication].keyWindow makeKeyAndVisible]