gpt4 book ai didi

iphone - UIRefreshControl 无限期挂起

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:11:11 24 4
gpt4 key购买 nike

我有一个 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com