UISearchBar of UISearchController moves off screen when active
<p>I need to have a <code>UISearchBar</code> <strong>above</strong> a <code>UITableView</code> (ie. the search bar is not part of the table view), and what I found is that when the search bar is activated, it moves off screen.</p>

<p>I did a fair bit of search and could not find a solution, there are ‘search bar off screen’ issues but they are adding search bar to table's header view and tweaking properties like <code>definesPresentationContext</code> fixed it.</p>

<p>My view hierarchy:</p>

<p>VC’s view
|— top view
       |— segmented control
       |— search bar
|— table view</p>

<p>Looks like UISearchController expects the search bar to be inside the table view, and always shifts the table view so that the search bar moves to the very top of screen.</p>

<p>Anyone having the same issue and found a solution?</p>

<p>Thanks a lot!</p>