I have this problem on the app I am transitioning to iOS 7 from iOS 6.
I have a navigation bar in xib, under them is a tableview with attached UISearchDisplayController subclass; because I had to handle searching default behaviour which make the search bar go up and hides the navigation bar below it in iOS 6 by the following code:
-(void)setActive:(BOOL)visible animated:(BOOL)animated
{
if(self.active == visible)
{
return;
}
[self.searchContentsController.navigationController setNavigationBarHidden:YES animated:NO];
[super setActive:visible animated:animated];
[self.searchContentsController.navigationController setNavigationBarHidden:NO animated:NO];
if (visible) {
[self.searchBar becomeFirstResponder];
} else {
[self.searchBar resignFirstResponder];
}
}
Now that I want to transition it to iOS 7, the behaviour changed, whenever I write text inside search bar, navigation bar is hidden without the search bar going up, and search results table is overlapped by search bar, so the navigation bar stays hidden until search is ended.
I want to know what is the cause of this behaviour and how can I maintain the same behaviour without hiding the navigation bar.
Thanks in advance and all help is appreciated.
As far as the cause of the behavior, I believe this the standard operating procedure for UISearchDisplayController
s (as well as iOS 8's UISearchController
). UINavigationController
s, UITableView
s, etc. act in very special ways as far as appearance an animation when a UISearchBar
is found as the tableHeaderView
of a UITableView
.