I have a UIViewController with a UICollectionView in it and a UISearchBar on top of it. The problem is that when I click on my search bar and hide the navigation bar, the background color of the search bar does not spread under the status bar.
This is how I configured UISearchBar and UISearchController:
UINavigationController *searchResultsController = [[self storyboard] instantiateViewControllerWithIdentifier:[ADC_SEARCH_RESULTS_CONTROLLER_IDENT copy]];
self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];
self.searchController.searchResultsUpdater = self;
self.searchController.searchBar.frame = CGRectMake(0, 0, self.view.frame.size.width, 44.0);
[self.view insertSubview:self.searchController.searchBar belowSubview:self.navigationController.navigationBar];
self.definesPresentationContext = YES;
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
SuggestionResultsTVC *vc = (SuggestionResultsTVC *)searchResultsController.topViewController;
vc.tableView.contentInset = UIEdgeInsetsMake(0.0f, 0.f, 0.f, 0.f);
self.searchController.searchBar.clipsToBounds = YES;
Here is a screenshot of the UIViewController when the search bar is rejected:
http://s4.postimg.org/x0rncg5e5/Screen_Shot_2015_09_02_at_5_09_41_PM.png
And here is a screen shot of the view controller when the search bar is active:
http://s4.postimg.org/tv71m8mrx/Screen_Shot_2015_09_02_at_5_10_04_PM.png