0
自動演示UISearchController和我自己提供的搜索控制器之間的行爲不同。UISearchController不會在前面但在UISearchController下面推視圖控制器
@implementation MyViewComtroller
// click search barbutton on right of navigationBar
- (void)searchAction:(id)sender {
ArticleSearchViewController *searchResultsController = [[ArticleSearchViewController alloc] init];
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];
searchController.searchResultsUpdater = searchResultsController;
searchController.searchBar.delegate = searchResultsController;
searchController.delegate = searchResultsController;
searchController.hidesNavigationBarDuringPresentation = NO;
[self presentViewController:searchController animated:YES completion:nil];
}
@end
@implementation ArticleSearchViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
ArticleDetailController * articleDetailController = [ArticleDetailController new];
[(UINavigationController *)self.presentingViewController pushViewController:articleDetailController animated:YES];
}
@end
推動動作發生在UISearchController下面。
如果爲SearchResultsControl設置了一個UINavigationController ler,推動動作發生在UISearchController上,但searchBar不能隱藏動畫。 – weiminghuaa