我有两个视图,一个是根视图控制器,另一个是搜索视图控制器。当我在搜索视图控制器的 UISearchBar 上单击取消时,我想回到根视图控制器。我有这个代码:
-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
[self.navigationController popToRootViewControllerAnimated:YES];
}
但是当我单击取消时,我收到此错误:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'search contents navigation controller must not change between -setActive:YES and -setActive:NO'
我究竟做错了什么?[self.navigationController popToRootViewControllerAnimated:YES];
我的搜索视图中其他领域的作品。