forum

Home / DeveloperSection / Forums / How to change background color of UILabel in UITableViewCell

How to change background color of UILabel in UITableViewCell

Anonymous User 1725 08-Dec-2015

I have created an app on iPhone using UITableViewCell within table view and I put an UILabel into table view cell.
I want to change the background color of UILabel.
this is my code:

UILabel *myLabel = (UILabel*)[cell.contentView.subviews objectAtIndex:0];
myLabel.textColor = [UIColor blueColor];
mylabel.backgroundColor = [UIColor greyColor];
mylabel.opaque = YES;

Now, please anyone tell me the problem in my code.

Thanks in advance..!


Updated on 09-Dec-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By