0

The searchResultsTableView of my UISearchDisplayController is always hidden (hidden=YES) in searchDisplayControllerDidBeginSearch:. Setting the property manually does not help unfortunately.

Here is my code:

self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self];
self.searchController.delegate = self;
self.searchController.searchResultsDataSource = self;
self.searchController.searchResultsDelegate = self;
self.searchController.searchResultsTableView.clipsToBounds = NO;
self.menuList.tableHeaderView = self.searchBar;

The search bar is correctly shown, but when I start searching and click into the search bar the whole table view is gone.

- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller
{
   // po self.searchController.searchResultsTableView
   // <UISearchResultsTableView: 0xc8ff600; frame = (0 0; 320 284); hidden = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0xc08f370>; layer = <CALayer: 0xc08f0b0>; contentOffset: {0, 0}>
}
gpichler
  • 2,181
  • 2
  • 27
  • 52
  • Did you check your Filtered array according to text typed in search bar? – Vishal Sharma Apr 07 '14 at 08:37
  • Filtered array is correct, there is only an appearence problem with the UISearchDisplayController – gpichler Apr 07 '14 at 08:57
  • If your filtered array is correct then problem doesn't seems in search display controller. – Vishal Sharma Apr 07 '14 at 09:01
  • The problem is more in the searchResultsTableView as this view disappears with the search bar and the tableview, if I click into the search bar and wanted to start editing. – gpichler Apr 07 '14 at 09:09
  • Can`t exactly get you.. – Vishal Sharma Apr 07 '14 at 09:11
  • [see this link](http://www.appcoda.com/how-to-add-search-bar-uitableview/) where search display controller is implemented, With sample Code.. Hope It may help you :) – Vishal Sharma Apr 07 '14 at 09:16
  • I'm sorry, may my question is a little bit confusing. The functionality of my search bar does work, the only thing what's not working is the tableView of the searchDisplayController. When I set a breakpoint in `searchDisplayControllerDidBeginSearch` the searchResultsTableView is always hidden. – gpichler Apr 07 '14 at 11:33
  • Have you fill different table for UISearchdisplayController`s TableView?? See and Get reference from link attached by me in upper comment. good luck. – Vishal Sharma Apr 07 '14 at 11:38

0 Answers0