最佳答案
如果您的 View Controller 是您的搜索栏委托(delegate),您可以从那里实现 searchBarCancelButtonClicked
函数和 resignFirstResponder
。
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
searchBar.text = ""
searchBar.resignFirstResponder()
// or you could force view to end editing mode using self.view.endEditing(true)
}
关于ios - 如何在 ui 搜索栏中的 x 按钮操作事件上 resignfirstResponder?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37132015/