UITableViewCell点击时改变文本颜色

在如下方法中设置:

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
   
    if (selected) {
        self.textLabel.textColor = LightRedColor;
    }else
    {
        self.textLabel.textColor = App_BackgroundColor;
    }
   
    // Configure the view for the selected state
}

并且 不要写如下语句:


[tableView deselectRowAtIndexPath:indexPath animated:YES];


你可能感兴趣的:(UITableViewCell点击时改变文本颜色)