如何从容器中删除上次添加的视图控制器
我已使用此代码删除上次添加的视图容器
UIViewController *vc = [self.childViewControllers lastObject];
[vc.view removeFromSuperview];
[vc removeFromParentViewController];
[self.ctr addSubview:news.view];
答案 0 :(得分:0)
First Call Method willMoveToParentViewController:nil
然后调用从超级视图中删除
[vc willMoveToParentViewController:nil];
[vc.view removeFromSuperview];