3

我已将 a 添加UIRefreshControl到 aUITableView并且它似乎在连续动画,即使它不可见。

通过 Frank 控制台运行frankly_map "view:'_UIRefreshControlModernReplicatorView'", "isAnimating"显示错误视图实际上是私有 UIKit _UIRefreshControlModernReplicatorView,它继续在屏幕外设置动画。

关于为什么会发生这种情况或如何停止动画的任何建议?

复制回购 => https://github.com/samst0r/UIRefreshControlFrank

我已经包含了代码的重要部分=>

- (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];
    });
}
4

1 回答 1

2

在隐藏之前,请使用以下代码停止刷新:

[refrshControl endRefreshing];
于 2014-02-07T14:03:40.413 回答