Reputation: 31
I'm implementing SearchDisplayController in a ViewController. It's working propertly except for one thing: I'm controlling the searchResultTableView property to resize the tableView where the results are shown this control is done in the textDidChange method of the saarchBar.
But when I type the first character the tableView doesn't resizes, only does it when I type the second character. Here is my code:
- (void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
CGRect tableFrame= self.searchDisplayController.searchResultsTableView.frame;
tableFrame.size.height=400;
tableFrame.size.width=300;
[self.searchDisplayController.searchResultsTableView setFrame:tableFrame];
[self.searchDisplayController.searchResultsTableView reloadData];
}
I also tried to resize the tableView in the searchDisplayControllerDidBeginSearch, didLoadSearchResultTableView or viewDidLoad methods but it didn'd work.
What am I doing wrong?
Upvotes: 2
Views: 2111
Reputation: 2975
- (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView
worked for me
Upvotes: 6