Yury Pogrebnyak Yury Pogrebnyak - 9 months ago 44
iOS Question

UIRefreshControl not working when called prorgammatically

I have a

in my
and a method
to handle "pull to refresh" event. It works perfectly when actually pulling, but when I call
[refresh beginRefreshing]
in code, it just shows refresh animation but doesn't call the

Here's code for initializing refresh control in

UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
[refresh addTarget:self
self.refreshControl = refresh;

Answer Source

Based on my understanding on the documentation: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIRefreshControl_class/Reference/Reference.html

Tells the control that a refresh operation was started programmatically. ... Call this method when an external event source triggers a programmatic refresh of your table.

I think it is not used to start a refresh operation, rather it is just for updating the refresh control status that it is currently refreshing, in which it will make the refresh control spinning. The purpose will be to avoid the user pulling the table view and trigger the refresh operation again while it is still refreshing.

So you should call the refreshView: method by yourself.