大佬教程收集整理的这篇文章主要介绍了ios – UIAlertController有时会阻止UIRefreshControl隐藏,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我使用的代码,所有UI的东西都很好地在主线程上完成:
if(refreshControl.refreshing) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^{ [self refreshItems]; dispatch_async(dispatch_get_main_queue(),^{ [refreshControl endrefreshing]; [self.tableView reload]; [self showupdateInfo]; }); }); }
知道是什么原因引起的吗?
编辑:这是我在代码中创建刷新控件的方法(在viewDidLoad中):
UIrefreshControl *refreshControl = [[UIrefreshControl alloc] init]; refreshControl.attributedtitle = [[NSAttributedString alloc] initWithString: @"checking for updates…"]; [refreshControl addTarget: self action: @SELEctor(refreshOutdatedItems) forControlEvents: UIControlEventValueChanged]; self.refreshControl = refreshControl;
- (void)refreshOutdatedItems { NSLog(@"refresh"); if (self.refreshControl.refreshing) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,^{ for (double i = 0 ; i < 100000000; i++){ }; dispatch_async(dispatch_get_main_queue(),^{ [self.refreshControl endrefreshing]; [self performSELEctor:@SELEctor(showupdateInfo) withObject:nil afterDelay:0.5]; }); }); } }
如果有帮助,请告诉我.
以上是大佬教程为你收集整理的ios – UIAlertController有时会阻止UIRefreshControl隐藏全部内容,希望文章能够帮你解决ios – UIAlertController有时会阻止UIRefreshControl隐藏所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。