I am using the UISearchController
alongside its UISearchBar
. The UISearchController
alongside its UITableView
is placed inside a subview in my main view.
My goal is to lock the UISearchBar in its place so when its active, it does not move. Right now the following is happening:
I have searched this issue extensively and have tried the following such as:
self.searchController.hidesNavigationBarDuringPresentation = false
, which just abruptly moves the search bar to the middle of the screen.definesPresentationContext = true
, which does not change behaviorself.extendedLayoutIncludesOpaqueBars = true
, which does not change behaviorUsing the
UIBarPositioningDelegate
method mentioned here, which strangely cannot be translated to Swift because I cannot insert theAnyObject<UIBarPositioning>
as it is in the Objective C version and still have it recognized as theoverride
function
Any suggestion is appreciated.
Edit:
Here is the setup for the search items:
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
searchTableView.tableHeaderView = searchController.searchBar