iphone - UISearchBar 和 resignFirstResponder

标签 iphone uitableview uisearchbar first-responder

我有一个非常基本的 UITableView,带有附加的 UISearchBar,这是发生的流程

UITableView 为空,用户点击 UISearchBar,然后调出键盘。 用户点击搜索按钮后

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { 
    [searchBar resignFirstResponder]; //move the keyboard out of the way
    //Code....  
}

工作得很好,将键盘移开,并填充 UITableView。 问题在于任何后续搜索尝试。

发生与之前相同的步骤,但是键盘永远不会消失。我有一种感觉,有其他东西正在成为响应者,我只需要一点清晰度来理解实际发生的事情。

最佳答案

如果没有看到你的代码,很难猜测。但是,如果您包括:

[self.view endEditing:YES];

所有 View 都将辞去第一响应者。

关于iphone - UISearchBar 和 resignFirstResponder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3424172/

相关文章:

ios - 使用缓冲区上传 iOS 7

iphone - 在编辑内容 UIWebView 时隐藏键盘

swift - 具有核心数据问题的搜索栏

arrays - 用于 UISearchBar 的过滤数组

iphone - 如何检测 iPhone 5(宽屏设备)?

iphone - UIScrollView趋于 "snap"回到之前的位置

iphone - 如何定义uitableviewcells

ios - 无法在容器 View 中填充 TableView

ios UITableView reloadData 不增加内容高度

ios - UISearchDisplayController 处于事件状态时搜索栏上方的额外空间