I am having a tableview and I want to know that how can I change the selected row\'s text color, say to Red ? I tried by this code :
- (UITableViewCell *)tableV
If you're already subclassing UITableViewCell
, it's easier/cleaner to set the colors in the awakeFromNib
method (assuming you're instantiating from a storyboard or xib).
@implementation MySubclassTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
self.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:0.1 green:0.308 blue:0.173 alpha:0.6];
self.customLabel.highlightedTextColor = [UIColor whiteColor];
}
@end