簡體   English   中英

UIRefreshControl持續動畫,即使它不可見

[英]UIRefreshControl is continuously animating, even when it is not visible

我已經在UITableView添加了一個UIRefreshControl ,它看起來是連續動畫的,即使它不可見。

通過Frank控制台運行frankly_map "view:'_UIRefreshControlModernReplicatorView'", "isAnimating"顯示錯誤的視圖實際上是私有的UIKit _UIRefreshControlModernReplicatorView ,它繼續為屏幕設置動畫。

有關為什么會發生這種情況或如何停止動畫的任何建議?

Replication Repo => 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];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM