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];
});
}
所以我已經包含上面的代碼片段。我已經調用了'endRefreshing'(2秒後參數)。任何其他想法? –