1

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.

0

1 Answer 1

1

I found the answer here UISearchController searchbar hides the first cell in tableview

Changing my code to this fixes the issue.

self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = self; self.searchController.dimsBackgroundDuringPresentation = NO; self.searchController.searchBar.delegate = self; self.searchController.delegate = self; self.searchController.searchBar.scopeButtonTitles = [NSArray array]; self.itemsTableView.tableHeaderView = self.searchController.searchBar; self.definesPresentationContext = YES; [self.searchController.searchBar sizeToFit]; self.extendedLayoutIncludesOpaqueBars = true; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.