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

[self.refreshControl endRefreshing];

此解决方案来自类似的question,但尚未解决我的问题。

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

在我的viewDidLoad中:
[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/

10-12 05:40