ios - UISearchBarDelegate 和 textFieldShouldClear 替代方案

标签 ios uisearchbar

UITextFieldDelegate 有一个方法 - (BOOL)textFieldShouldClear:(UITextField *)textField 当用户点击那个小的 x 图标时会调用它。

我找不到与 UISearchBarUISearchBarDelegate 类似的东西。是否有另一种方法可以确定是否已在 UISearchBar 中单击该按钮/图标?

最佳答案

您可以使用:

searchBar:textDidChange:

根据Reference当按下 X 清除字段时也会被调用。

关于ios - UISearchBarDelegate 和 textFieldShouldClear 替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12011986/

相关文章:

javascript - 地理位置不适用于 iOS 和 Meteor

ios - fatal error : could not demangle keypath type

ios - 是否可以在单独的文件中包含UISearchBarDelegate扩展名?

objective-c - 使用 UISearchBar 时使 View 的其余部分变灰

ios - 搜索显示 Controller 结果 TableView 无法在 iOS 6 中滚动

ios - 以编程方式处理 iOS 设备旋转

ios - 将 CAShapeLayer 应用于单元格内的多个 UIImageViews

iphone - 禁用添加到 UITableView 的 UISearchbar 的滚动

iphone - UISearchBar 键盘外观

ios - UICollectionView 动画数据变化