我遇到了cellForRowAtIndexPath没有返回单元格的问题。
以下是我的服务输出
(
{
AcNo = 667;
Avg = 2;
Address = New York;
busReviews = (
{
Id = 270;
businessName = "Pharmacy Inc";
comment = "Good Product.";
},
{
Id = 269;
businessName = "Agro Buss Inc";
comment = "Looks like a great product.";
}
);
}
)
当我尝试在busReviews的表视图中检索数据时。它只显示第一条记录而不是第二条记录。
以下是我的尝试。请帮我找到问题。 TIA
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellIdentifier"];
}
NSMutableDictionary * thisRow = [detailsarr objectAtIndex:indexPath.row];
times = [thisRow objectForKey:@"busReviews"];
NSMutableDictionary* refilldict = [times objectAtIndex:0];
NSString *column1 = [refilldict objectForKey:@"businessName"];
NSString *column2 = [refilldict objectForKey:@"comment"];
reviewname.text=[NSString stringWithFormat:@"%@%@",@"-by ",column1];
review.text= [NSString stringWithFormat:@"%@",column2];
cell.selectionStyle=UITableViewCellSelectionStyleGray;
return cell;
}
return nil;
}