Aleks
Aleks

Reputation: 121

UISearchResultsTableView doesn't appear when UISearchBar becomes active

I need my searchBar to display search results when searchbar's textfield becomes active. I use

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar 

call, but have no object to show UISearchResultsTableView at once. It shows only when entering fist letter in search textfield.

Upvotes: 1

Views: 93

Answers (2)

marchiore
marchiore

Reputation: 598

Use this method:

- (void)textFieldDidBeginEditing:(UITextField *)textField;

It will be executed on touch the textfield .

Upvotes: 0

Keerthi Shekar
Keerthi Shekar

Reputation: 176

Logic of filtering out the search result should be added in

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText

delegate method.

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar 

can be used to refresh the array objects when you start editing the search bar.

Upvotes: 3

Related Questions