2

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?

gnat
  • 6,213
  • 108
  • 53
  • 73

1 Answers1

6
- (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView

worked for me

Or Arbel
  • 2,965
  • 2
  • 30
  • 40