Ios UISearchController在iPad上显示全屏而不是弹出窗口
我想建立一个像地图应用程序一样的搜索控件;搜索会在iPhone上打开一个结果表视图(工作正常),应该会在iPad上的popover中打开一个表视图。这在Ios UISearchController在iPad上显示全屏而不是弹出窗口,ios,objective-c,uitableview,ipad,uisearchcontroller,Ios,Objective C,Uitableview,Ipad,Uisearchcontroller,我想建立一个像地图应用程序一样的搜索控件;搜索会在iPhone上打开一个结果表视图(工作正常),应该会在iPad上的popover中打开一个表视图。这在UISearchDisplayController中曾经是自动的,但现在已经不起作用了,它在iPad上显示了全屏桌面视图 self.resultsController = [[EFResultTableViewController alloc] init]; [self.resultsController.tableView setDelegat
UISearchDisplayController
中曾经是自动的,但现在已经不起作用了,它在iPad上显示了全屏桌面视图
self.resultsController = [[EFResultTableViewController alloc] init];
[self.resultsController.tableView setDelegate:(id<UITableViewDelegate>)self];
self.searchController =
[[UISearchController alloc] initWithSearchResultsController:self.resultsController];
[self.searchController setSearchResultsUpdater:(id<UISearchResultsUpdating>)self];
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = NO;
[self.searchController.searchBar setBarTintColor:[UIColor whiteColor]];
[self.searchController.searchBar setDelegate:(id<UISearchBarDelegate>)self];
self.definesPresentationContext = YES;
self.resultsController=[[EFResultTableViewController alloc]init];
[self.resultcontroller.tableView setDelegate:(id)self];
自动搜索控制器=
[[UISearchController alloc]initWithSearchResultsController:self.resultsController];
[self.searchController setSearchResultsUpdater:(id)self];
self.searchController.dimsBackgroundDuringPresentation=否;
self.searchController.hidesNavigationBarDuringPresentation=否;
[self.searchController.searchBar setPartIntColor:[UIColor whiteColor]];
[self.searchController.searchBar setDelegate:(id)self];
self.definesPresentationContext=是;
ResultableViewController
只是一个定制的表视图。我不想写IS\u IPAD
条件代码。这里有我遗漏的东西吗。解决方案非常简单,你需要在控制器上设置样式,它会自动在iPhone和iPad上显示正常列表
[self.searchController setModalPresentationStyle:UIModalPresentationPopover]代码>