Melvin Lai
Melvin Lai

Reputation: 901

Custom Cells and detail Text Label

Just wanna ask this question. Can I use detailTextLabel in a Custom Cell? I wanna have additional info to be displayed in my custom cell. When I tried to use the detailTextLabel, nothing is displayed.

The custom cell .m codes:

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

Upvotes: 1

Views: 1562

Answers (2)

Jhaliya - Praveen Sharma
Jhaliya - Praveen Sharma

Reputation: 31722

you could also use the detailTextLabel of UITableViewCell.

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

Have look to blog post for using detailTextLabel with cell.

Show multiline text cells in UITableView

Upvotes: 0

jigneshbrahmkhatri
jigneshbrahmkhatri

Reputation: 3637

If you want to display additional details, you can take one more UILabel in your custom cell

Upvotes: 1

Related Questions