Setting searchController on UINavigationItem introduces a separator line ignoring navigation bar customizations

Originator:curtis.clifton
Number:rdar://33410257 Date Originated:19-Jul-2017 01:36 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.0 (15A5318e)
Classification:Serious Bug Reproducible:Always
 
Summary:
UINavigationBar provides API for styling the bar’s appearance. By setting the bar’s `barTintColor`, `backgroundImage`, and `shadowImage`, plus adding a subview positioned via auto layout, we are able to remove the system default bottom divider line and introduce our own custom, partial width bottom divider. However, if we take advantage of the (excellent) new `UINavigationItem.searchController` feature of iOS 11, the system injects its own bottom divider, ignoring the `shadowImage`.

Steps to Reproduce:
1. Build and run the attached project
2. Notice the partial-width magenta divider below the navigation bar.
3. Edit TableViewController.swift, changing line 14 to enable search.
4. Build and run again.
5. Notice that the magenta divider appears, but an additional full-width gray divider also is added.
6. Pull down to reveal the search bar.
7. Notice that the gray divider stays “glued” to the table view contents while the magenta divider stays glued to the navigation bar contents.

Expected Results:
- The system should use the navigation bar’s `shadowImage` rather than using its own full-width bottom stroke.
- Ideally there would be a mechanism for us to position our custom divider view such that it moves with the system’s divider.

Actual Results:
An additional full-width gray divider also is added, ignoring the navigation bar’s `shadowImage`.

Version:
11.0 (15A5318e)

Notes:
It appears that the additional divider is a UIImageView. We could scrounge the private view hierarchy for this image view, constrain our divider to the image view’s position, and set the image view’s alpha to 0. But that would be terrible.

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!