【问题标题】:Set up a UISearchDisplayController for a UITableViewController without a UISearchBar为没有 UISearchBar 的 UITableViewController 设置 UISearchDisplayController
【发布时间】: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


【解决方案1】:

当搜索显示控制器显示和关闭时,我最终只是将hidden 字段设置为 NO 和 YES。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多