8

Is there a way to detect if a user has click on the searchbar textfield and the keyboard has appear ?

4

3 回答 3

12

文档中,

  • searchBarTextDidBeginEditing:
  • searchBarCancelButtonClicked:
于 2012-12-06T22:00:06.353 回答
11

如果您正在实现 UISearchBarDelegate,则应调用的第一个方法是:

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {  
    //do stuff
    return YES;  
}  

这是类参考:

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UISearchBarDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UISearchBarDelegate/searchBarShouldBeginEditing

于 2010-01-19T18:29:04.197 回答
3

Your searchbar delegate should receive a searchBarTextDidBeginEditing: message.

于 2010-01-19T18:24:33.010 回答