Using showDetailViewController breaks UINavigationItem.searchController

Number:rdar://32815205 Date Originated:June 16 2017, 5:18 PM
Status:Open Resolved:
Product:iOS Product Version:11.0, all betas
Classification:UIKit Reproducible:Yes
In a split view based app on iPhone, when pushing a detail view controller using [self showDetailViewController:sender:], the detail view controller won't show its navigationItem.searchController search bar.

Instead the insets will be a bit wrong and any scroll view content will jump up behind the bar when you try to reveal the search bar.

If you use showViewController:sender: instead, the large navigation bar and the search field will show up correctly. However, this is not always the correct thing to do it split view based apps.

Steps to Reproduce:
1. Create a split view controller based app and run it on iPhone (I tested on iPhone SE simulator).

2. Make a master navigation controller whose navigation bar prefersLargeTitles = YES.

3. Use showDetailViewController:sender: to push a UITableViewController which has its navigationItem.searchController set to a UISearchController

4. Try to reveal search bar.

Expected Results:
The search bar should show up below the large title

Observed Results:
The search bar doesn't seem to exist, and content insets get bugged and the content end up behind the navigation bar

iOS 11 Beta (all builds)

Workaround: Use showViewController:sender: instead of showDetailViewController:sender:. This however will break the intended behaviour of a split view based app.


Response from Apple June 27 2017, 5:46 PM

Thanks, we are working on the new information you provided. We appreciate your help!

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!