Skip to main content
Post Closed as "Duplicate" by rmaddy objective-c

For some reason, the headerView of my UITableView is overlapping the first cell.

enter image description here

Here is the code that sets up the UISearchController:

 self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = self; self.searchController.dimsBackgroundDuringPresentation = NO; self.searchController.searchBar.delegate = self; self.searchController.delegate = self; self.itemsTableView.tableHeaderView = self.searchController.searchBar; self.definesPresentationContext = YES; [self.searchController.searchBar sizeToFit]; self.extendedLayoutIncludesOpaqueBars = true; 

If I do a search, then cancel the search, the tableview will display correctly.

I'm not sure how to even begin fixing this. Any help would be appreciated.

For some reason, the headerView of my UITableView is overlapping the first cell.

enter image description here

Here is the code that sets up the UISearchController

 self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = self; self.searchController.dimsBackgroundDuringPresentation = NO; self.searchController.searchBar.delegate = self; self.searchController.delegate = self; self.itemsTableView.tableHeaderView = self.searchController.searchBar; self.definesPresentationContext = YES; [self.searchController.searchBar sizeToFit]; self.extendedLayoutIncludesOpaqueBars = true; 

If I do a search, then cancel the search, the tableview will display correctly.

I'm not sure how to even begin fixing this. Any help would be appreciated.

For some reason, the headerView of my UITableView is overlapping the first cell.

enter image description here

Here is the code that sets up the UISearchController:

self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = self; self.searchController.dimsBackgroundDuringPresentation = NO; self.searchController.searchBar.delegate = self; self.searchController.delegate = self; self.itemsTableView.tableHeaderView = self.searchController.searchBar; self.definesPresentationContext = YES; [self.searchController.searchBar sizeToFit]; self.extendedLayoutIncludesOpaqueBars = true; 

If I do a search, then cancel the search, the tableview will display correctly.

I'm not sure how to even begin fixing this.

Source Link
Hackmodford
  • 4k
  • 5
  • 40
  • 80

UITableView tableHeaderView overlaps first cell

For some reason, the headerView of my UITableView is overlapping the first cell.

enter image description here

Here is the code that sets up the UISearchController

 self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = self; self.searchController.dimsBackgroundDuringPresentation = NO; self.searchController.searchBar.delegate = self; self.searchController.delegate = self; self.itemsTableView.tableHeaderView = self.searchController.searchBar; self.definesPresentationContext = YES; [self.searchController.searchBar sizeToFit]; self.extendedLayoutIncludesOpaqueBars = true; 

If I do a search, then cancel the search, the tableview will display correctly.

I'm not sure how to even begin fixing this. Any help would be appreciated.