如何限制UISearchController在IOS8中隐藏视图导航栏

如何限制UISearchController在IOS8中隐藏视图导航栏,ios8,uinavigationcontroller,uisearchcontroller,Ios8,Uinavigationcontroller,Uisearchcontroller,我在popover中嵌入了一个UIViewController。此控制器有两个子视图,一个UINavigationBar和一个MapView。我尝试实现新的搜索控制器,即UISearchController,因为iOS8中不推荐使用UISearchDisplayController 当我单击搜索栏(显示两个范围)时,一切正常,导航栏仍然可见。但当我开始在搜索栏中输入时,导航栏和键盘消失了,取而代之的是暗淡的地图视图。我试图添加self.searchController.hidesNavigati

我在popover中嵌入了一个UIViewController。此控制器有两个子视图,一个
UINavigationBar
和一个
MapView
。我尝试实现新的搜索控制器,即
UISearchController
,因为iOS8中不推荐使用UISearchDisplayController

当我单击搜索栏(显示两个范围)时,一切正常,导航栏仍然可见。但当我开始在搜索栏中输入时,导航栏和键盘消失了,取而代之的是暗淡的地图视图。我试图添加
self.searchController.hidesNavigationBarDuringPresentation=NOupdateSearchResultsForSearchController:
方法中的code>以及
SearchBar应开始编辑:
方法,但未得到任何结果。(请注意,控制器
viewDidLoad
定义了
self.definesPresentationContext=YES;


任何时候强制显示导航的想法?

首先设置此属性
self.definesPresentationContext=YES在ViewDidLoad中。然后执行
searchBarTextShouldBeginEditing
searchBarTextDidBeginEditing
方法,如下所示:

-(void)searchBarTextShouldBeginEditing:(UISearchBar *)searchBar {
[searchControllerMain setActive:YES];
[searchControllerMain.searchBar becomeFirstResponder];}
-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
[searchControllerMain setActive:YES];
[searchControllerMain.searchBar becomeFirstResponder];
searchControllerMain.hidesNavigationBarDuringPresentation = NO;
}

它会起作用的

你能发布你的代码吗(至少是与
UISearchController
相关的部分代码)对我不起作用。不过,我在导航控制器中有一个选项卡控制器。