为什么"detailTextLabel“不再起作用?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.textLabel.text=[listData objectAtIndex:[indexPath row]];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text=@"hi";
return cell;
}发布于 2011-07-24 01:05:55
尝试更改单元格的样式,请在初始化单元格时使用此代码
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease]; 有关单元格样式的更多信息,请查看apple's class reference
发布于 2011-07-24 01:05:58
您选择了不支持detailTextLabel的单元格样式UITableViewCellStyleDefault
尝试使用不同的样式。
编辑
您可以在initWithStyle:reuseIdentifier;方法中选择样式。看一下描述可用单元格样式的UITableViewCell文档。
https://stackoverflow.com/questions/6801911
复制相似问题