UISearchViewController causes UITableView contentInset to be modified incorrectly when navigation bar is opaque

Number:rdar://123412341234 Date Originated:Sept 7th 2018
Status:Open Resolved:No
Product:iOS Product Version:11.4
Classification:SDK Reproducible:Always


Using a `UISearchBar` through a `UISearchController` while using a UITableViewController to display results/possibilities, and then push navigating away and back while the search controller is active causes the search bar to be incorrectly inset below the navigation bar if bar.isTranslucent = false. 

Steps to Reproduce:

Create sample app: use UISearchController to attach a UISearchBar to a TableView. Set up UITableViewDelegate to push navigate onto another screen on cell click. Make sure to set UINavigationBar.isTranslucent = false. Set up the destination view controller such that you are able to dismiss it and navigate back.

1. Open app.
2. Activate / press UISearchBar to search. 
3. Press any cell without cancelling the search.
4. Navigate back to original screen. 

Expected Results:

The inset is as we left it on navigation and still properly set.

Actual Results:

The `UITableView` offset will be incorrectly configured, whether the search state is active or not upon completion of step 4. (returning navigation). 


iOS 11.4 


No configurations set.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!