【发布时间】:2012-03-08 04:09:59
【问题描述】:
我正在以一种非常规的方式使用 UISearchViewController。
我的 UISearchBar 最初是隐藏的。当用户点击一个按钮时,我取消隐藏 UISearchBar 并激活 UISearchViewController。我还设置了搜索栏的文本,并告诉搜索栏成为第一响应者。
问题在于 UISearchDisplayController 创建的灰色叠加层仍然可见。除非清除我预设的文本并且用户开始重新输入,否则它不会消失。
self.searchDisplayController.searchBar.hidden = NO;
self.searchDisplayController.searchBar.text = @"term";
[self.searchDisplayController.searchBar becomeFirstResponder]; // this actually appears to activate everything
[self.searchDisplayController setActive: YES animated: YES]; // this activates but does not set the searchbar to 1st responder...
为什么 UISearchDisplayController 继续显示它的灰色覆盖,我该如何清除它?
【问题讨论】:
标签: ios uisearchdisplaycontroller