I am using UISearchController
to search for data in my tableview. I am not using table view controller. I would like to hide the navigation bar when my search bar is active therefore I set self.searchController.hidesNavigationBarDuringPresentation = YES;
to yes.
However when I do this and want to search, my active search bar covers part of the first cell. the covered part has same height as status bar.
I tried other articles and questions similar to this one but nothing helped me to solve it. Then I started to play with the table view header size. I did this
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 20.0f;
}
The result was that when I tapped search bar an started to search problem was not there anymore.
However when the search bar is not active there was a gab between searchbar and first cell
Any ideas how to fix this issue?
Edit: after adding self.automaticallyAdjustsScrollViewInsets = false;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…