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


猜你喜欢

转载自blog.csdn.net/heartofthesea/article/details/46431125