cojoj cojoj - 5 months ago 13
Objective-C Question

UIRefreshControl bug after entering foreground

I've noticed a little bug (but really annoying) when I use

in my View Controller. When I call application back form background and try to refresh the
is already loaded and it look like this:

enter image description here
enter image description here

As you can see I use a custom navigation controller which hides like in Facebook app (
). When I reaload data in
everything comes back to normal and this bug shows only after getting back from background.

This is the code which I use to initialize

// Initializing generic refresh control
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(collectData) forControlEvents:UIControlEventValueChanged];
[self.tableView addSubview:self.refreshControl];


This is a known bug in iOS7. You can see it reproduce in Apple's mail app. I can confirm it has not been fixed in iOS7.1 beta 5 iOS8.0 beta 3.

First, open a bug report at My radar number is rdar://14586451, which is a duplicate of rdar://14493713 (still open).

A proposed fix is to register for UIApplicationWillEnterForegroundNotification notifications in your view controller and call [self.refreshControl.superview sendSubviewToBack:self.refreshControl]; to somewhat remedy the issue by having the refresh control appear behind your table content.

I see in the second screenshot that the refresh control shows under your cell. This is likely because you have set a clear color as your cell's background. Set it to white.