UISearchController searchBar in tableHeaderView animating out of the screen
Add
self.extendedLayoutIncludesOpaqueBars = YES;
on viewDidLoad
method
Have you tried to set the hidesNavigationBarDuringPresentation to false?Solved my headache..
self.searchController.hidesNavigationBarDuringPresentation = false;
Putting the searchbar in the navigation bar gives a more solid user experience in my opinion (for iphone)
self.navigationItem.titleView = self.searchController.searchBar;
To make this clearer @Lorenzo's answer worked for me.
self.definesPresentationContext = YES;