Search code examples
iosuitableviewios4uisearchdisplaycontroller

Hide UISearchDisplayController of UITableView initially ( iOS SDK )?


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.


Solution

  • 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.