ios - UIRefreshControl 持续动画,即使它不可见

标签 ios uitableview animation uirefreshcontrol frank

我已将 UIRefreshControl 添加到 UITableView 中,即使它不可见,它似乎也在持续动画。

通过运行 frankly_map "view:'_UIRefreshControlModernReplicatorView'", "isAnimating" Frank 控制台显示,错误的 View 实际上是私有(private) 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];
    });
}

最佳答案

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

[refrshControl endRefreshing];

关于ios - UIRefreshControl 持续动画,即使它不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21629301/

相关文章:

ios - UITableview委托(delegate)方法在json方法之前调用

ios - 使用自定义动画打开 View Controller

ios - 以圆周运动绕一点移动物体

ios - YouTube视频停止在iPhone上运行-黑屏

ios - 如何正确使用时区

iphone - 在 Objective C 中控制多线程

ios - UITableView后台查看平移手势

ios - 你如何将字幕添加到 NSArray

iOS 2 UITableViews 并更改隐藏属性或 1 并更改源

javascript - 分区和动画