我已经实现了 UISearchController 并且它工作得很好,除了......
当我单击搜索栏时,导航栏按预期消失。当我将手机旋转到横向视图时,我得到了这个有意义的视图。
但是,当我将手机旋转回纵向视图(仍在搜索类型区域中选择)时,我得到以下视图。
您可以看到导航栏永远不会再次出现。我觉得我正在实现一个基本的搜索控制器。这可能是什么原因造成的?
self.venueSearchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.venueSearchController.searchResultsUpdater = self;
self.venueSearchController.searchBar.delegate = self;
self.venueSearchController.dimsBackgroundDuringPresentation = NO;
self.venueSearchController.hidesNavigationBarDuringPresentation = YES;
self.venueSearchController.searchBar.frame = CGRectMake(self.venueSearchController.searchBar.frame.origin.x, self.venueSearchController.searchBar.frame.origin.y, self.venueSearchController.searchBar.frame.size.width, 44.0);
self.definesPresentationContext = YES;
self.navigationController.navigationBar.translucent = YES;
self.venueSearchController.searchBar.translucent = YES;
self.tableView.tableHeaderView = self.venueSearchController.searchBar;