2014-02-07 27 views
3

我已將UIRefreshControl添加到UITableView,並且它似乎持續動畫,即使它不可見。UIRefreshControl即使在不可見的情況下也會持續動畫

通過 弗蘭克控制檯運行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]; 
    }); 
} 

回答

2

之前隱藏它,停止與清爽下面的代碼:

[refrshControl endRefreshing]; 
+0

所以我已經包含上面的代碼片段。我已經調用了'endRefreshing'(2秒後參數)。任何其他想法? –

相關問題