Results misaligned for UISearchController

Originator:rene.jc.dekker
Number:rdar://28958269 Date Originated:26-Oct-2016
Status:Open Resolved:
Product:iOS Product Version:10.0
Classification: Reproducible:Always
 
Area:
UIKit

Summary:
For a standard setup, with the searchbar in the navigation bar, and the search results in a UITableViewController, a small gap shows between the top of the search results and the search bar in portrait orientation. In landscape orientation the opposite is true: the searchbar partly overlaps the search results.

Steps to Reproduce:
1) Run the attached project which sets up the UISearchController in the following manner:

- (void) viewDidLoad
{
    [super viewDidLoad];
    
    SearchResults *searchResults = [[SearchResults alloc] init];
    searchController = [[UISearchController alloc] initWithSearchResultsController:searchResults];
    searchController.searchResultsUpdater = searchResults;
    
    self.navigationItem.titleView = searchController.searchBar;

    searchController.hidesNavigationBarDuringPresentation = NO;
    searchController.dimsBackgroundDuringPresentation = YES;
    self.definesPresentationContext = YES;
}

2) Tap on the search bar and enter some text

Expected Results:
The search results to show directly under the searchbar

Actual Results:
In portrait mode: a gap appears between searchbar and search results
In landscape mode: the searchbar overlaps the search results

Version:
iOS 10.0

Notes:

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!