During the search I want to disable the pull to refresh mechanism. So I disabled the refresh control and removed it. But when pull down to refresh the beginRefresh method is called and the cells keep being down for 2 seconds like there is a refresh.
func searchBarShouldBeginEditing(searchBar: UISearchBar) -> Bool {
resultSearchController.searchBar.selectedScopeButtonIndex = 0
refreshControl!.enabled = false
refreshControl?.removeFromSuperview()
return true
}
When search then check if refreshControl has superView and Remove from superView After search End Add it again, the condition will look like :
Try with this code, it worked for me:
You will need to implement the
UISearchBarDelegate
in order to call those functions.It also works for iOS 9
Best regards
Use these two functions if you want to create or delete refresh controls in the top of UITableView.