让我们来看看实现代码如下的一些标准规范如何dequeueReusableCellWithIdentifier:处理不同的indexPath?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
static int count = 0;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
NSLog(@"count %d", count++);
}
// Configure the cell...
cell.textLabel.text = [array objectAtIndex:indexPath.row];
return cell;
}
如果我们在阵列10个项目,那么它将ALLOC 10个细胞的每个indexPath.row
我的问题是 请问该功能reuseIdentifier :CellIdentifier知道不同的行?