1

I'm using an instance of UIRefreshControl to reload the data in a UITableView.

If I run the app on any phone except the iPhone 6+, the refresh-control will disappear after the data refresh has finished.

However, if I run the app, on the iPhone 6+, the refresh-control will stay visible after the user has pulled down on the table-view to refresh the data. Below is a screenshot of the refresh-control visible behind elements of the table-view:

enter image description here

This behavior does not occur on any other phone except for the 6+. Below is the code for refreshing the table-view data, which is inside of viewWillAppear:

    if (self.refreshControl == nil) {
        UIRefreshControl *refreshControl = [UIRefreshControl new];
        refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@" "];
        refreshControl.tintColor = [UIColor refreshColor];
        [refreshControl addTarget:self action:@selector(refreshTableView:) forControlEvents:UIControlEventValueChanged];

        self.refreshControl = refreshControl;

        self.tableView.backgroundView.layer.zPosition -= 1;
    }

Does anyone know why the refresh control will stay visible when refreshing a table-view on the 6+?

narner
  • 2,908
  • 3
  • 26
  • 63
  • What happens when you put a breakpoint in? – Moshe Mar 20 '15 at 12:49
  • I get a warning (just as I do when running the app) of " Attempting to change the refresh control while it is not idle is strongly discouraged and probably won't work properly." – narner Mar 20 '15 at 12:51

1 Answers1

1

According to the accepted answer on this post, you have to manually remove and disconnect the refresh control.

That feels hack, and indeed, several[1] places[2] on the internet[3] seem to suggest calling endRefreshing inside of viewDidLoad. Some variations call for removing the refresh control and others say to endRefreshing instead.

Since I'm unsure which works, and because it probably depends on what your view controller looks like, I'll leave that up to you.

Community
  • 1
  • 1
Moshe
  • 57,511
  • 78
  • 272
  • 425
  • Hey Moshe, thanks again for your help and answer. I tried the answers in the links you shared, but unfortunately; have not had any success yet. More investigation needed I suppose. I'll be sure to post here when I learn the solution! – narner Mar 24 '15 at 13:10
  • Sorry to hear that you didn't solve the problem yet! I'm out of ideas for now, short of a code escalation with the Apple folks, but that's your choice. That, or file a radar. ;) – Moshe Mar 24 '15 at 13:29
  • Might not be a bad idea, actually. What's the difference between 'code escalation and filing a radar? Thanks again! – narner Mar 24 '15 at 13:31
  • 1
    You're allowed to request code-level support twice per membership year from Apple. Filing a radar is simply filing a bug on bugreport.apple.com. The code level incidents are actually better for this kind of thing, only because there isn't too much info available online. – Moshe Mar 24 '15 at 16:36