1
最近我注意到当我们创建一个新的Class模板时,(UcodeableViewController实现的子类中的Xcode - > File - > New - > File)在cellForRowAtIndexPath
方法中是部分的。我粘贴下面的方法。在UITableViewController模板中缺少TableViewCell分配
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
return cell;
}
我认为像报表(其中缺失),
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
是必须实施。这是一个错误还是别的?