【发布时间】:2015-10-01 10:48:42
【问题描述】:
我想构建一个类似地图应用的搜索控件;搜索会在 iPhone 上打开一个结果表视图(工作正常),并且应该在 iPad 上的弹出窗口中打开一个表视图。这曾经在 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;
ResultTableViewController 只是一个自定义的表格视图。我不想写IS_IPAD 条件代码。我在这里有什么遗漏吗?
【问题讨论】:
标签: ios objective-c uitableview ipad uisearchcontroller