code_junkie

Changing the background color of a UILabel within a UITableViewCell

Nov 11th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. UILabel* label = (UILabel*)[cell.contentView.subviews objectAtIndex:0];
  2. label.textColor = [UIColor whiteColor];
  3. label.backgroundColor = [UIColor darkGrayColor];
  4. label.opaque = YES;
  5.  
  6. - (void) layoutSubviews
  7. {
  8. [super layoutSubviews];
  9.  
  10. self.textLabel.backgroundColor = [UIColor redColor];
  11. }
  12.  
  13. UILabel* label = [[[UILabel alloc] init] autorelease];
  14. label.textColor = [UIColor whiteColor];
  15. label.backgroundColor = [UIColor darkGrayColor];
  16. label.opaque = YES;
  17. [cell.contentView addSubview:label];
Add Comment
Please, Sign In to add comment