How to hide UIRefreshControl when UISearchBar becomes active?
2 answers
@Bejibun led me to an answer to this comment . You just need to set the table offset to (0 - refresh_control_height).
so .. self.tableView.contentOffset = CGPointMake (0, 0 - self.refreshControl.frame.size.height);
+2
source to share
The best solution I've found so far is to turn off the update completely while the search bar is active.
@property(nonatomic, strong) UIRefreshControl *refreshControl;
....
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
// Disable refresh control
self.refreshControl = self.tableViewController.refreshControl;
self.tableViewController.refreshControl = nil;
return YES;
}
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
//Restore refresh control
self.tableViewController.refreshControl = self.refreshControl;
}
+2
source to share