2

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

[self.refreshControl endRefreshing];

这个解决方案来自一个类似的问题,但它没有解决我的问题。

即使这样,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];
                });
                });
                }];
}
4

1 回答 1

3

你能试着改变这条线吗

[self.tableView addSubview:refreshControl];

[self setRefreshControl:refreshControl];
于 2013-03-06T17:59:02.420 回答