如何通过 indexPathsForVisibleRows 读取 NSIndexpaths 数组的 intValue?
顺便说一句,为什么 visibleCells 和 indexPathsForVisibleRows 在 if (cell == nil) 函数之前不起作用?
这是我的代码:
在 cellForRowAtIndexPath 方法中:
static NSString *identifierString;
UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:identifierString];
// when I use visibleCells and indexPathsForVisibleRows here, the app crashes
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifierString] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
}
// when I use visibleCells and indexPathsForVisibleRows here, the app works
//cell implementation here
return cell;