UISearchBar disappears behind UINavigationBar

I have set my UISearchBar (using UISearchController) to the iOS8 standards, and I add it programmatically to my UIViewController above my UITableView (believe the only way to do this for iOS8 at the moment) like in my DidLoad view (unlike all other tutorials. in which they are added to the TableView header). I wanted me to stick with when scrolling my UITableView:

self.automaticallyAdjustsScrollViewInsets = NO;
UITableViewController *searchResultsController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
searchResultsController.tableView.dataSource = self;
searchResultsController.tableView.delegate = self;
CGRect frame = [[UIScreen mainScreen] applicationFrame];
CGSize size = frame.size;
self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];

self.searchController.searchResultsUpdater = self;
self.searchController.searchBar.frame = CGRectMake(0, 60, size.width, 44.0);
self.definesPresentationContext = YES;

[self.view addSubview:self.searchController.searchBar];

      

The problem I'm running into is that when I click in my search box, it disappears behind my UINavigationBar, going up, which doesn't usually happen if it's in the UITableView title.

Is there a way to stop this? Thank!

+3


source to share


1 answer


In the storyboard select the appropriate viewcontroller -> Attributes.



Mark all three extended edges (below the top bars, below the bottom bars, below the opaque bars) enter image description here

0


source







All Articles