问题描述
我有一个 tableView,其中每个单元格都包含一个具有不同标题的按钮。
实际上我正在将一个 titles 数组传递给按钮。cell.applyButton.setTitle(titleValues[indexPath.row],for: .normal)
现在我只想让那些具有标题时间表的按钮可点击。请帮忙。
解决方法
根据标题设置按钮的 .isEnabled
属性:
cell.applyButton.setTitle(titleValues[indexPath.row],for: .normal)
cell.applyButton.isEnabled = titleValues[indexPath.row] == "Schedule"