Im using a UIViewController with a tableView. I've setup a searchcontroller and embed the searchbar into the tableview header. When i search it leaves a status bar sized gap between the tableview and the uiview above it. I realize there are a lot of other questions on SO about this but none of them solved this problem.
Here is the code for setting up the searchbar:
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = YES;
self.searchController.searchBar.delegate = self;
self.searchController.searchBar.backgroundImage = [UIImage new];
self.searchController.searchBar.backgroundColor = kBlueNavBarColor;
self.searchController.searchBar.tintColor = [UIColor whiteColor];
self.tableView.tableHeaderView = self.searchController.searchBar;
self.definesPresentationContext = YES;