How can I hide UISearchDisplayController of UITableView initially ? I just want user to scroll up to see the UISearchBar.
UPDATE: I am thinking of scrolling the UITableView 40px lower, so that the UISearchBar can be "hidden" from user.
How can I hide UISearchDisplayController of UITableView initially ? I just want user to scroll up to see the UISearchBar.
UPDATE: I am thinking of scrolling the UITableView 40px lower, so that the UISearchBar can be "hidden" from user.
My solution is in viewWillAppear:animted
:
[my_table_view setContentOffset:CGPointMake(0, searchController.searchBar.bounds.size.height)];
UPDATE we should obtain the height of UISearchBar
instead of using fixed values.
Here is how I hide search bar in view will appear. This snipped will make sure that search bar is initially hidden only at the very first time of view will appear call.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//hide search bar
if (_searchBarRevealed == NO) {
self.tableView.contentOffset = CGPointMake(0, 44);
_searchBarRevealed = YES;
}
}