表拉动刷新不起作用

时间:2015-12-22 10:04:06

标签: ios

当我刷新表格时,它没有刷新,也没有在屏幕上显示圆圈。 这是我的代码: -

refreshControl = [[UIRefreshControl alloc]init];

[self.tableHolidays addSubview:refreshControl];

[refreshControl addTarget:self action:@selector(refreshTable) forControlEvents:UIControlEventValueChanged];

- (void)refreshTable {
    [refreshControl endRefreshing];
    [self.tableHolidays reloadData];
} 

3 个答案:

答案 0 :(得分:1)

尝试交换序列

- (void)refreshTable {

    [self.tableHolidays reloadData];
    [refreshControl endRefreshing];
} 

答案 1 :(得分:0)

- (void)viewDidLoad 
{
    [super viewDidLoad];
    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
    [self.tableView addSubview:refreshControl];
}

- (void)refresh:(UIRefreshControl *)refreshControl
{
    // Do your stuff here, when done:
    [refreshControl endRefreshing];
}

答案 2 :(得分:0)

首先完成桌面上的所有操作,同时刷新&然后结束更新。

- (void)refreshTable { [self.tableHolidays reloadData]; [refreshControl endRefreshing]; }