Occasionally my table view won't be connected to a service to refresh, and in that case, I don't want the UIRefreshControl to be present.
After I add it in viewDidLoad, I've tried hiding it under certain circumstances with setEnabled:
and setHidden:
but neither seems to work.
I solved this problem by calling
"yourRefreshControl".endEditing()
inside the refresh function.I solved it this way:
The best to implement UIRefreshControl is below.
When there is no more record to load then remove refreshControl by below line
I have implemented same working fine.
I had bad experience when set
tableView.refreshConrol = nil
, because when I set it back to oldrefreshControl
, it started animation only in a second, so it looked not good, so when I need to disablerefreshControl
I use:when I need it back I use:
P.S. Setting
isHidden, isEnabled, isUserInteractionEnabled
didn't helpYou have several ways to do this. I think the best way is to do a check in the viewDidLoad method with:
if this isn't possible the best way is put this code where you want to hide the refresh (I think in viewWillAppear method in if condition)
Try this: