I created a UISearchController
programmatically in a UITableViewController
. It works fine but the search bar isn't displaying correctly with the status bar. Here is my code and some screenshots. It also makes a funny animation when canceling the search.
- (void)viewDidLoad
{
[super viewDidLoad];
_resultsTableViewController = [ResultsTableViewController new];
_searchController = [[UISearchController alloc] initWithSearchResultsController:_resultsTableViewController];
_searchController.searchResultsUpdater = _resultsTableViewController;
_searchController.dimsBackgroundDuringPresentation = NO;
self.definesPresentationContext = YES;
self.tableView.tableHeaderView = _searchController.searchBar;
}
There should be more padding here with the status bar.
When you I cancel searching I get a bad animation here that's the height of the status bar.