使用NSCoder時,我在哪裏添加我的自定義tableview單元格標籤在我的UITableview中? 我已經創建了UITableViewCell類並將所有內容都吸引到界面構建器中。使用NSCoder時,我在哪裏添加我的自定義tableview單元格標籤在我的UITableview中?
我試圖替換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時」是什麼意思? – Matt 2013-03-24 07:00:25
我只是說,因爲通常的方式來實現這個不會工作cell.label.text = [addDrill objectAtIndex:indexPath.row]; – 2013-03-24 13:48:20