UITableView 添加系统下拉刷新控件

481 阅读1分钟
    UIRefreshControl *refreshController = [[UIRefreshControl alloc] init];
    // 设置加载指示器颜色
    refreshController.tintColor = [UIColor brownColor];
    // 设置文字颜色
    NSDictionary *attributes = @{ NSForegroundColorAttributeName: [UIColor blackColor] };
    // 提示文字
    refreshController.attributedTitle = [[NSAttributedString alloc] initWithString:@"下拉刷新" attributes:attributes];
    [refreshController addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
    self.tableView.refreshControl = refreshController;
- (void)refresh:(UIRefreshControl *)sender {
    
    [sender endRefreshing];
}