iphone - UIRefreshControl 无限期挂起

标签 iphone ios asynchronous uirefreshcontrol

我有一个 UIRefreshControl,当您使用它时它工作正常,但它挂起,它永远不会消失。我试过了

[self.refreshControl endRefreshing];

此解决方案来自类似的 question ,但它没有解决我的问题。

即使如此,refreshControl 仍然继续旋转,而不是关闭。为什么是这样?

在我看来DidLoad:

[NSThread detachNewThreadSelector:@selector(refreshFeed) toTarget:self withObject:nil];

refreshControl = [[UIRefreshControl alloc] init];

[refreshControl addTarget:self
                   action:@selector(refreshFeed)
         forControlEvents:UIControlEventValueChanged];

[self.tableView addSubview:refreshControl];

refreshFeed 方法...

-(void)refreshFeed
//load those feeds
{
RSSLoader* rss = [[RSSLoader alloc] init];    
[rss fetchRssWithURL:feedURL
            complete:^(NSString *title, NSArray *results) {
                dispatch_queue_t downloadQueue = dispatch_queue_create("downloader",NULL);
                dispatch_async(downloadQueue, ^{

                _objects = results;

                //completed fetching the RSS
                dispatch_async(dispatch_get_main_queue(), ^{
                    [self.refreshControl endRefreshing];
                    [self.tableView reloadData];
                });
                });
                }];
}

最佳答案

您可以尝试更改此行

[self.tableView addSubview:refreshControl];

[self setRefreshControl:refreshControl];

关于iphone - UIRefreshControl 无限期挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15251341/

相关文章:

ios - 迁移多个 Realm - Realm 版本大于架构版本异常

ios - 如果 iOS 中不允许应用程序旋转,如何使特定 View Controller 自动旋转启用?

ios - 基于 UIPinch 缩放图像

c# - ContinueWith 方法不会等到异步任务完成

asynchronous - Go lang gRPC异步操作的理解与实现

c++ - Xcode iPhone : Removing text from a . txt 文件

iphone - 通讯录查看iphone SDK

iphone - ios uiwebview 在 shouldstartloadwithrequest 时停止请求

javascript - AngularJS HTTP GET 请求有时返回的不是最新的数据集

iphone - 如何在 UIView 下绘制阴影?