iOS11.2 iPad landscape, static split view, new SearchController pattern, SearchBar usage spacing issue

Close to finishing my first app, but stuck on a bug that I cannot solve - posted on StackOverflow with no replies; please navigate to the following for details, and reply in either place:

https://stackoverflow.com/questions/48918656/ios11-2-ipad-landscape-static-split-view-new-searchcontroller-searchbar-usage-sp

Thanks for your help!

Can you explain the view heiarchy, starting at rootcontroller, thanks.

Did you try to scroll the view in position, with either :


func scrollToRow(at: IndexPath, at: UITableViewScrollPosition, animated: Bool)

Scrolls through the table view until a row identified by index path is at a particular location on the screen.


or

func scrollToNearestSelectedRow(at: UITableViewScrollPosition, animated: Bool)

Scrolls the table view so that the selected row nearest to a specified position in the table view is at that position.

No, I let row 0 always stay at the top of the view (unless the user scrolls); the pics are all with row 0 at top, though thanks for letting me know about these methods, as I suspect I may need one or both of them if the user selects a summary detail record that is not within view in the master list (I present a detail list that delegates back to the master and selects the corresponding row in the master list which could be out of view). I appreciate the heads up.

Progress! Found the following on SO: https://stackoverflow.com/questions/31424540/uisearchcontroller-searchbar-and-scopebar-overlap-on-first-touch-event


Though sizeToFit() still did not resolve anything, adding 'searchController.searchBar.showsScopeBar = false' to my configSearchController() method resolved the issue of the first row appearing under the scopeBar when a second search is requested. Unfortunately, whether cancelling the first, second, or any future search, or selecting a filtered row, I still have the space between the search bar and the first table row; the only way to correct it (thus far) is to back up and enter the scene again (ugly, ugly, ugly). Though it makes no intuitive sense to state that the scopeBar should not be shown, it fixed one of the issues I'm having.

New issue - I was able to resolve my problems implementing the searchController under iOS11, by simply adopting the Apple-preferred implementation that hides the navigation bar during presentation (though that was not what I initially weanted to do; regardless, it works, and it's better than what it looked like). However, I am now attempting to make my app backward compatible to iOS9, where the searchController is embedded in the tableHeaderView instead of as a navigationItem, and now I am having wierd behaviors under iOS9!


The searchBar appears from the start rather than being pulled down to reveal as in iOS11 (which is fine). However, scrolling up hides the searchBar along with the top half of the first table row. Tapping on the searchBar replaces the navigationBar with the searchBar and scope buttons (though it would be great if it was the same gray, rather than a darker gray). When I dismiss/cancel the search, the searchBar disappears and the first table row spaces lower than where it started. I can scroll up, and part of the extra space goes away, but it now bounces from the bottom of where the scroll buttons were diplayed. Obviously, I can no longer search, as the searchBar is gone.


How can I replicate the iOS11 search behaviors under iOS9? I have, once again, tried all the various flags and switches and checkboxes, and simply make it worse. Any suggestions before I waste another few weeks? Thanks all.

iOS11.2 iPad landscape, static split view, new SearchController pattern, SearchBar usage spacing issue
 
 
Q