Hide UISearchDisplayController from UITableView natively (iOS SDK)?

How can I hide a UISearchDisplayController from a UITableView natively? I just want the user to browse the UISearchBar page.

UPDATE: I think the scroll of the UITableView is 40px lower so that the UISearchBar can be β€œhidden” from the user.

+4
source share
2 answers

My solution is in viewWillAppear:animted :

 [my_table_view setContentOffset:CGPointMake(0, searchController.searchBar.bounds.size.height)]; 

UPDATE we should get the height of the UISearchBar instead of using fixed values.

+7
source

This is how I hide the search bar in view. This cut off will ensure that the search bar is first hidden only the first time the call appears.

 - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; //hide search bar if (_searchBarRevealed == NO) { self.tableView.contentOffset = CGPointMake(0, 44); _searchBarRevealed = YES; } } 
+1
source

All Articles