Weird iOS bug with UITableViewCell and userInteractionEnabled

后端 未结 2 1294
天涯浪人
天涯浪人 2020-12-19 02:53

I just noticed something very strange with the UITableViewCell class on iOS and the userInteractionEnabled property.

It appears that if userInteractionEnabled is set

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-19 03:33

    I think I found a more convenient workaround for this problem (which I consider to be a bug):

    Set the enabled property on textLabel and detailTextLabel manually like this:

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

    This led me to the answer: https://stackoverflow.com/a/13327632/921573

提交回复
热议问题