UITableViewCell textColor will not change with userInteractionEnabled = NO

前端 未结 2 1884
粉色の甜心
粉色の甜心 2020-12-21 03:45

I am trying to simply change the color of my UILabel using the textColor property and it will not work when userInteraction is disabled, this does

2条回答
  •  醉话见心
    2020-12-21 04:30

    Please check my answer to a similar question:

    https://stackoverflow.com/a/18552074/921573

    Setting the enabled property on the textLabels accordingly fixes this:

    cell.userInteractionEnabled = (indexPath.row % 2) == 0;
    cell.textLabel.enabled = cell.isUserInteractionEnabled;
    cell.detailTextLabel.enabled = cell.isUserInteractionEnabled;
    

提交回复
热议问题