我的ViewController有孩子,它的偉大工程,但是當我改變根視圖到另一個,然後返回背根視圖:的setView與ChildViewController
-(void)showSearchResultView
{
self.searchView.frame = self.view.frame;
__rootView = self.view;
[self setView:self.searchView];
}
-(void)hideSearchResultView
{
if(__rootView) [self setView:__rootView];
__rootView = nil;
}
,我發現了異常:
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'child view controller:<SlideViewController> should have parent view controller:
<UINavigationController> but actual parent is:<MainViewController>'
使用子視圖控制器更改根視圖的正確方法是什麼?
我該如何刪除視圖控制器,其實是哪裏?我可以改變視圖,當viewcontroller沒有孩子只是使用setView屬性。 – HotJard