如果 UIRefreshControl 以编程方式启动,(beginRefreshing 然后 endRefreshing )当它不可见时,则在下次手动刷新时 UIRefreshControl 动画中会持续闪烁。
在 UITableViewController 子类中添加此方法并在 2 秒后执行拉动刷新,您将看到闪烁
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
UIRefreshControl * refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl = refreshControl;
[self.refreshControl beginRefreshing];
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];
});
}
如何避免这种闪烁?