- (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