Fix UISearchdisplaycontroller searchbar at top of UITableView

948 views Asked by At

I have a UITableView and UISearchDisplayController but when i scroll tableview the searchbar also scrolls along with it. To overcome this i moved UISearchDisplayController searchbar outside UITableView and now my layout is as below, also adjusted the searchbar y position to 65 & corresponding adjusted height of tableview

View
  -> SearchBar
  -> TableView
       -> ContentListCell

After moving out searchbar, when i start searching the searchbar moves above and its not seen. How can i fix the issue? I want to keep the searchbar at the top position.

Thanks.

1

There are 1 answers

2
mbo42 On

If you don't want the UISearchbar to move up when becoming active, you can set the property displaysSearchBarInNavigationBar to NO for UISearchDisplayController.