我正在使用indexpathforvisiblerows,它给出了uitableview中可见行的索引路径。我如何检查返回的索引路径中的空白单元格?如何检查UITableViewCells是否为空
`NSArray * visiblePaths = [self.rootViewController.accountTableView indexPathsForVisibleRows];
为(NSIndexPath * indexPath在visiblePaths) {
UITableViewCell *cell = [self.rootViewController.accountTableView cellForRowAtIndexPath:indexPath];
// I am getting the issue when i call this function
cell.detailTextLabel.text = [self getLastCallDate:indexPath];
}
// getLastCallDate功能
帐户*帐户= [self.fetchedResultsController objectAtIndexPath:indexPath]; NSString * lastCallDate;
if ([[account Calls] count] > 0) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd"];
Call *call = [[account Calls] objectAtIndex:0];
lastCallDate = [NSString stringWithFormat:@"Last Call Date: %@",[dateFormatter stringFromDate:call.date]];
//NSLog(@"detail - %@", cell.detailTextLabel.text);
[dateFormatter release];
return lastCallDate;
}
else
lastCallDate [email protected]"";
return lastCallDate;
` 在寻找读取的结果控制器不会有多达导致数组边界execption
不,我有几个tablecells有数据,其余都是空白的。我想要有数据的单元格的数量 – Vijay
@Vijay我已经更新了我的答案。 –