- (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;
}
我该如何解决这个错误?
答案 0 :(得分:-1)
您的tableData
或placeData
或XXXdata
的计数小于您的手机数量。
你可以在这些方面做一些断点。
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
查看它是否超出范围。