views:

127

answers:

1

I have a custom UITableViewCell with a UILabel and a UITextView in it.

I want the text for both of these to appear white when the user highlights the UITableViewCell. It's obviously very simple to set the highlightedTextColor of the UILabel, but the UITextView doesn't seem to have any similar type of property. Am I going to have to manually change the color of the UITextView whenever the cell becomes highlighted/unhighlighted or is there an easier way of accomplishing this?

Thanks!

A: 

Found it and it was a lot easier than I thought. Just need to use the UITableViewCell setHighlighted method.

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
    [super setHighlighted:highlighted animated:animated];

    if (highlighted) {
        [self.myTextView setTextColor:[UIColor whiteColor]];
    } else {
        [self.myTextView setTextColor:[UIColor blackColor]]; 
    }

}
mjdth