私はこれを持っていますがUISearchDisplayController
、これまでのところsearchresulttableview
、誰かがUISearchBar
. ボタンにこのタスクを実行させる方法はありますか? 受け取った回答に感謝します。
3 に答える
3
ボタンセレクター内で試しました[searchDisplayController.searchbar becomeFirstResponder]
か?
于 2013-11-04T23:42:43.243 に答える
2
Look at the docs for UISearchDisplayController
. There is an active
property and a setActive:animated:
method.
Have your button action call this:
[theSearchController setActive:YES animated:YES];
于 2013-11-04T23:52:28.953 に答える
1
のようにUISearchBar
拡張されるため、検索バーを呼び出すだけでフォーカスを当てることができます。UIResponder
UITextField
becomeFirstResponder
[button addTarget:self action:@selector(clickedSearchBar) forControlEvents:UIControlEventTouchUpInside];
- (void)clickedSearchBar {
[searchDisplayController.searchbar becomeFirstResponder];
}
于 2013-11-04T23:44:23.927 に答える