- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @"CustomCellIdentifier";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
if (cell == nil)
{
//cell = [[[CustomCell alloc] initwithidentifier:CustomCellIdentifier] autorelease];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
for (id oneObject in nib)
if ([oneObject isKindOfClass:[CustomCell class]]) {
cell = (CustomCell *)oneObject;
}
}
NSUInteger row = [indexPath row];
NSDictionary *rowData = [self.listData objectAtIndex:row];
cell.nameLabel.text = @"text";
[cell.contentView addSubview: nameLabel];
[cell reloadInputViews];
return cell;
}
但名稱標籤不會顯示其新名稱。請問我做錯了什麼? 謝謝!UITableViewCell不顯示數據
什麼是nameLabels框架?此外,您似乎將nameLabel作爲子視圖添加到該單元格中,即使它已經在其中。該代碼應該可能在初始化時位於customcell類中。這也可能是你爲什麼沒有看到任何變化。 – Ben 2010-10-12 14:44:21
我只是爲了試圖查看它是否有所作爲而添加了該行。我不認爲它是需要的 - 既不在這裏也不在初始化 – Lilz 2010-10-12 14:48:31