Reputation: 155
I have a UISearchBar
from a Search Display Controller and want the UISearchBar
to be selected when the view is Loaded.
Can anyone tell me how this can be done?
Upvotes: 2
Views: 593
Reputation: 65613
Call the method becomeFirstResponder
on the search bar.
[searchBar becomeFirstResponder]
will programmatically select the search bar. See the UIResponder docs for more details on this.
Upvotes: 1
Reputation: 35394
Try
[searchBar becomeFirstResponder];
in your viewDidAppear
method
and when the user pushes the "search button", call
[searchBar resignFirstResponder];
and begin your search algorithm.
Upvotes: 2