【发布时间】:2012-01-21 14:08:35
【问题描述】:
可能是个愚蠢的问题。
我有一个 UITableview,有多个单元格。在每个单元格中,我都显示了一些数据。我没有使用单元格的文本属性来显示数据。相反,我的单元格中有一个自定义标签,用于显示文本。 我的问题是: 当我单击单元格时,我需要从单元格中检索数据。我该怎么做。
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
UILabel *CellTextlabel = [[UILabel alloc] init];
CellTextlabel.tag = 222;
[CellTextlabel setFrame:CGRectMake(40, 5, 200, 20)];
[cell.contentView addSubview:CellTextlabel];
[CellTextlabel release];
}
UILabel *editCellTextlabel = (UILabel *)[cell.contentView viewWithTag:222];
editCellTextlabel.font = [UIFont boldSystemFontOfSize:18];
editCellTextlabel.text = contact.lastName;
【问题讨论】:
-
发布你用来填充单元格的代码。
标签: iphone ios uitableview uilabel didselectrowatindexpath