-6
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"SimpleTableItem";

    SimpleeTableCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    cell.TitleLabel.text = [tableData objectAtIndex:indexPath.row];
    cell.PlaceLabel.text = [placeData objectAtIndex:indexPath.row];
    cell.imageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]];
    cell.RankingsLabel.text = [rankingsData objectAtIndex:indexPath.row];
    cell.StatusLabel.text = [statusData objectAtIndex:indexPath.row];
    cell.DistanceLabel.text = [distanceData objectAtIndex:indexPath.row];



    return cell;
}

我该如何解决这个错误?

4

1 回答 1

-1

您的tableDataorplaceDataXXXdata的计数小于您单元格的计数。
您可以在这些行中设置一些断点。
cell.TitleLabel.text = [tableData objectAtIndex:indexPath.row]; cell.PlaceLabel.text = [placeData objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]]; cell.RankingsLabel.text = [rankingsData objectAtIndex:indexPath.row]; cell.StatusLabel.text = [statusData objectAtIndex:indexPath.row]; cell.DistanceLabel.text = [distanceData objectAtIndex:indexPath.row]; 您也可以使用tableData.count它来查看它是否超出范围。

于 2015-11-17T11:33:17.143 回答