Search code examples
iosiphoneobjective-crefreshuirefreshcontrol

UIRefreshControl Stuck After Switching Tabs in UITabBarController


I have a UITableViewController as the root view controller in a UINavigationController, which is in turn one of the view controllers in a UITabBarController. All hooked up in Storyboard.

I've configured the UIRefreshControl for my table in Storyboard as well, and normally it looks like it should when pulling:

Normal UIRefreshControl

However, if I switch between my other tabs once or twice, it looks like this:

Buggy UIRefreshControl

It's not spinning or anything, just stuck "full", and it stays that way until I pull fully and trigger a refresh.

Any ideas or suggestions appreciate.


Solution

  • I know this is incredibly late, but I figure better late than never.

    Unfortunately, none of the given answers worked for me. The only thing that worked was this awful piece of code in viewWillAppear:

    self.refreshControl = nil;
    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(refreshFunction) forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refreshControl;
    

    Basically I recreate the UIRefreshControl every time the view is going to appear. It works, albeit while giving the following warning:

    Attempting to change the refresh control while it is not idle is strongly discouraged and probably won't work properly.

    I'm honestly surprised this is still an issue (still seeing this in iOS 9 now). Hopefully this may be helpful to some other people.