1

就是想问这个问题。我可以在自定义单元格中使用 detailTextLabel 吗?我想在我的自定义单元格中显示其他信息。当我尝试使用 detailTextLabel 时,没有显示任何内容。

自定义单元格 .m 代码:

- (void)setUseDarkBackground:(BOOL)flag{
if (flag != useDarkBackground || !self.backgroundView)
{
    useDarkBackground = flag;

    NSString *backgroundImagePath = [[NSBundle mainBundle] pathForResource:useDarkBackground ? @"BGDark" : @"BGLight" ofType:@"png"];
    UIImage *backgroundImage = [[UIImage imageWithContentsOfFile:backgroundImagePath] stretchableImageWithLeftCapWidth:0.0 topCapHeight:1.0];
    self.backgroundView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease];
    self.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.backgroundView.frame = self.bounds;
}}
4

2 回答 2

1

如果要显示其他详细信息,可以在自定义单元格中再多取一个 UILabel

于 2011-07-01T05:25:37.613 回答
0

你也可以使用 detailTextLabelof UITableViewCell

@property(nonatomic, readonly, retain) UILabel *detailTextLabel

看看博客文章detailTextLabel与细胞一起使用。

在 UITableView 中显示多行文本单元格

于 2011-07-01T05:31:27.410 回答