我有一个非常基本的 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/