【发布时间】:2013-03-24 05:48:10
【问题描述】:
使用 NSCoder 时,我应该在 UITableview 中的何处添加自定义 tableview 单元格标签? 我已经创建了 UITableViewCell 类并将所有内容都连接到界面生成器中。
我尝试替换 cell.textLabel.text = oneName.name; with cell.label.text = oneName.name; 并且它只显示一个黑色方块。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (!cell) {
cell = [[CustomCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
NSUInteger row = [indexPath row];
DrillObject *oneName = [self.addDrill objectAtIndex:row];
cell.textLabel.text = oneName.name;
return cell;
}
【问题讨论】:
-
“使用 NSCoder 时”是什么意思?
-
我只是说,因为通常的实现方式不起作用 cell.label.text = [addDrill objectAtIndex:indexPath.row];
标签: uitableview xcode4.5 nscoder