I'm using a UISearchDisplayController.
When a user select a row in the table, I want to hide the search bar.
Here's my try:
- (void)displaySearchBar:(BOOL)show {
[UIView animateWithDuration:0.15
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
[m_searchDisplayController.searchBar setHidden:!show];
[m_categoriesView.categoriesTable setContentInset:show ?
UIEdgeInsetsMake(0,0,0,0) : UIEdgeInsetsMake(-CGRectGetHeight(m_searchDisplayController.searchBar.frame),0,0,0)];
if( show ) {
[m_categoriesView.categoriesTable setContentOffset:CGPointZero];
}
}
completion:NULL];
}
All works fine except when the user rotate the device. The search bar is hidden but I got a black space in top of the table.
Someone have a clue ?
Best regards,
Martin
why don't you use
instead of all that code. this will remove the keyboard as well