首页 > UITableView 上拉刷新 加载数据问题?

UITableView 上拉刷新 加载数据问题?

@property (strong, nonatomic) NSMutableArary *listArray;


#pragma mark - TableView datasource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    static NSString *CellIdentifier = @"ListTableViewCell";
    NewTab2TableViewCell *cell = (NewTab2TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if(cell == nil)
    {
        NSArray *nibs=[[NSBundle mainBundle] loadNibNamed:@"NewTab2TableViewCell" owner:self options:nil];
        cell = (NewTab2TableViewCell *)[nibs objectAtIndex:0];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;

        [cell setValue:CellIdentifier forKey:@"reuseIdentifier"];

    }

    //**遍历respont**//
    NSMutableDictionary *tempDic = [listArray objectAtIndex:indexPath.row];
    NSLog(@"tempDic = %@", tempDic);

    cell.timeLabel.text = [NSString stringWithFormat:@"%@", [tempDic objectForKey:@"bno"]];  // 时间

    return cell;
}


这里面listArray的数据是AFNetworking-POST请求的。


[manager POST:encodedUrl parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {

第一次请求返回的JSON,responseObject,是有10个这种的


然后我有个上拉刷新

[_tableView addLegendFooterWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

- (void)loadMoreData
{
// 代码省略
    [manager POST:encodedUrl parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"JSON_上拉刷新 : %@", responseObject);

}

上拉刷新继续返回10个数据,我想问的是在tableView的cellForRowAtIndexPath方法里,怎样把刷新后得到的新十个数据刷到tableview里面。也就是说tableview里有20个数据。


[_tableView addLegendFooterWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

楼主你能把省略的代码发出来吗?

// 代码省略

[manager POST:encodedUrl parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"JSON_上拉刷新 : %@", responseObject);

}


[tableView reloadData]
【热门文章】
【热门文章】