UITextFieldDelegate には、- (BOOL)textFieldShouldClear:(UITextField *)textFieldその小さなxアイコンがユーザーによってクリックされたときに呼び出されるメソッドがあります。
UISearchBarまたはに似たものが見つかりませんでしUISearchBarDelegateた。そのボタン/アイコンが 内でクリックされたかどうかを確認する別の方法はありますUISearchBarか?
UITextFieldDelegate には、- (BOOL)textFieldShouldClear:(UITextField *)textFieldその小さなxアイコンがユーザーによってクリックされたときに呼び出されるメソッドがあります。
UISearchBarまたはに似たものが見つかりませんでしUISearchBarDelegateた。そのボタン/アイコンが 内でクリックされたかどうかを確認する別の方法はありますUISearchBarか?
これはどうですか(そしてディスカッション文に注意してください):
searchBar:textDidChange:
Tells the delegate that the user changed the search text.
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
Parameters
searchBar
The search bar that is being edited.
searchText
The current text in the search text field.
Discussion
This method is also invoked when text is cleared from the search text field.
Availability
Available in iOS 2.0 and later.
Declared In
UISearchBar.h