这可能是一个非常简单的问题,但我有点困惑如何正确地做到这一点。我读到我需要删除这行代码:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
但是,我如何检查单元格是否不为零?我使用的完整代码如下。如果有人也可以解释这一行的目的:
static NSString *CellIdentifier = @"Cell";
完整代码:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}