首页 > 切换跟控制器后。上一个控制器presentViewController子控制器的VIew还在。为什么?

切换跟控制器后。上一个控制器presentViewController子控制器的VIew还在。为什么?

        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中。为什么没有伴随上一个控制器一起被销毁呢?

 [[UIApplication sharedApplication].keyWindow makeKeyAndVisible]
【热门文章】
【热门文章】