OGeek|极客世界-中国程序员成长平台

标题: iOS 10.0 UIRefreshControl 不显示指示器 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:36
标题: iOS 10.0 UIRefreshControl 不显示指示器

我正在使用具有下拉刷新功能的 UITableView,但是当我调用 [self.refreshControl beginRefreshing] 时,下拉刷新的微调器没有显示

上面的代码是在 viewDidLoad 内部调用的,因为表格最初正在加载一些数据。如果我在初始刷新后执行下拉刷新,微调器工作正常。显示标题,但不显示微调器。

似乎无法解决这个问题。它在 iOS 9.3.2 上运行良好,但在 iOS 10 上运行良好。

这是我目前使用的代码。

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setupView];
    [self customSetup];
    self.refreshControl = [[UIRefreshControl alloc] init];
    self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString"Updating Discounts..."];
    [self.refreshControl addTarget:self actionselector(reloadDeals) forControlEvents:UIControlEventValueChanged];
    [self.refreshControl beginRefreshing];
    [self.tableView setContentOffset:CGPointMake(0, -self.refreshControl.frame.size.height) animated:YES];
}

提前感谢您的帮助



Best Answer-推荐答案


代码前:

[refreshControl beginRefresh]

插入代码:

[refreshControl layoutIfNeeded]

关于iOS 10.0 UIRefreshControl 不显示指示器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39609848/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4