UITextView highlightedTextColor or similar option?

前端 未结 2 641
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 13:24

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

2条回答
  •  暖寄归人
    2021-02-06 14:12

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

提交回复
热议问题