iOS 10.0 UIRefreshControl未显示指示符 [英] iOS 10.0 UIRefreshControl not showing indicator

查看:189
本文介绍了iOS 10.0 UIRefreshControl未显示指示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个UITableView,它有一个下拉刷新功能,但当我调用[self.refreshControl beginRefreshing]

I am using a UITableView Which has a Pull down to refresh function but the spinner for pull down to refresh is not showing up when I call the [self.refreshControl beginRefreshing]

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

The above code is called inside the viewDidLoad cause the table is loading some data initially. The spinner works fine if I perform a pull down to refresh after the initial refresh. The title shows up but not the spinner.

似乎无法解决这个问题。它适用于iOS 9.3.2,但不适用于iOS 10。

Cant seem to solve this problem. It works fine on iOS 9.3.2 but not on iOS 10.

这是我目前使用的代码。

Here is the code I am using currently.

- (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 action:@selector(reloadDeals) forControlEvents:UIControlEventValueChanged];
    [self.refreshControl beginRefreshing];
    [self.tableView setContentOffset:CGPointMake(0, -self.refreshControl.frame.size.height) animated:YES];
}

感谢您的提前帮助

推荐答案

[refreshControl beginRefresh]

插入代码:

[refreshControl layoutIfNeeded]

这篇关于iOS 10.0 UIRefreshControl未显示指示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆