Reputation: 43
I've added a UIRefreshControl
to a UITableView
and it appears to be continuously animating, even when it is not visible.
Running frankly_map "view:'_UIRefreshControlModernReplicatorView'", "isAnimating"
through
Frank console reveals that the erroneous view is in fact the private UIKit _UIRefreshControlModernReplicatorView
which continues to animate off screen.
Any suggestions on why this is happening or how to halt the animation?
Replication Repo => https://github.com/samst0r/UIRefreshControlFrank
I've included the important bit of the code =>
- (void)viewDidLoad
{
[super viewDidLoad];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self
action:@selector(refresh)
forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
}
#pragma mark - Other
- (void)refresh {
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.refreshControl endRefreshing];
});
}
Upvotes: 3
Views: 311
Reputation: 6557
Before you hide it, stop the refreshing with the following code:
[refrshControl endRefreshing];
Upvotes: 2