【发布时间】:2014-04-26 05:49:17
【问题描述】:
我发现构建UISearchDisplayController 的唯一方法是在我的UITableViewController 上也构建一个UISearchBar。
但是,我不希望出现 UISearchBar,而是希望通过按下按钮来启动搜索。
这可能吗?
我尝试在按下按钮时激活UISearchDisplayController:
- (void)searchButtonPressed:(id)sender{
[self.searchDisplayController setActive:YES animated:YES];
}
这“有效”,但出现的searchDisplayController 没有UISearchBar。 (明显地)。
【问题讨论】:
-
UISearchDisplayController是专门为使用UISearchBar而编写的。如果您没有搜索栏,请不要使用UISearchDisplayController。你有什么样的 UI 允许用户在不输入任何搜索条件的情况下进行搜索? -
好吧,当 UISearchDisplayController 出现时,我确实想要显示一个 searchBar(这是我现在遇到的问题)。如果 UISearchDisplayController 没有出现,我只是不希望出现搜索栏。
标签: ios uisearchbar uisearchdisplaycontroller