Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UISearchController在iPad上显示全屏而不是弹出窗口_Ios_Objective C_Uitableview_Ipad_Uisearchcontroller - Fatal编程技术网

Ios UISearchController在iPad上显示全屏而不是弹出窗口

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

我想建立一个像地图应用程序一样的搜索控件;搜索会在iPhone上打开一个结果表视图(工作正常),应该会在iPad上的popover中打开一个表视图。这在
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]