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
Ok I know how to fix this but it does NOT make any sense at all, the problem is this line:
cell.userInteractionEnabled = NO;
If removed the textColor
changes, the odd thing is that if i change the user interaction at the end after changing the textColor
the color changes!
Is this a bug?. I hope this answer helps anyone trying to figure this out as it does not make any sense at all, and there is no documentation about this.
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;