UISearchController sets incorrect contentInset, scrollIndicatorInsets

Originator:futuretap
Number:rdar://30100635 Date Originated:19-Jan-2017 08:13 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:10.2 14C89
Classification:UI/Usability Reproducible:Always
 
Summary:
In a UITabBarController, that encloses a UINavigationController, that encloses a UITableViewController that presents a UISearchController, when the results controller is presented, its bottom edge inset will be incorrect when the keyboard animates into view.

Also, in landscape mode, the top scrollIndicatorInsets are incorrect.

Steps to Reproduce:
Open and run the attached sample project. The project includes two tabs: one with a search controller that is presented on tapping a bar button item, one that includes a search bar as the table view header view.

Expected Results:
The content insets as well as the scrollIndicatorInsets should be correct at all times.

Actual Results:
In both tabs, when opening the search and typing the first letter (so the keyboard comes up), the bottom contentInset is wrong (49 pt too large). When turning to landscape, the top scrollIndicatorInset is too large (although the top contentInset is correct).

Notes:
I've experimented with different choices which view controller sets "definesPresentationContext". In the current state of the project, the content view controllers define the context. When moving the flag to the navigation controllers or the tab bar controller (which should equally work imo), even weirder effects with the contentInset can be observed. Sometimes the top insets are wrong, sometimes the bottom insets are wrong and sometimes the bottom insets with hidden keyboard are wrong.

See also:
rdar://23634299 explains a similar issue with a bottom toolbar instead of a tab bar.

Comments


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!