UISearchBar的常用代理

下面是最常用的几个SearchBarDelegate:

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{
        //已经开始编辑
}// called when text starts editing

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar{
    NSLog(@"收键盘监听");
}// called when text ends editing


- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{
    //searchText是searchBar上的文字 每次输入或删除都都会打印全部
}// called when text changes (including clear)

//点击键盘上搜索时的相应事件
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{

}// called when keyboard search button pressed

 

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!
技术狗 » UISearchBar的常用代理