How to make some buttons of tableView cells clickable and some unclickable | iOS

345 Views Asked by At

I have a tableView in which each cell contains a button with different titles.

enter image description here

Actually I am passing a titles array to button.
cell.applyButton.setTitle(titleValues[indexPath.row], for: .normal)

Now I want to make only those buttons clickable which have title schedule. Please help.

1

There are 1 best solutions below

0
DonMag On

Set the button's .isEnabled property, based on the title:

cell.applyButton.setTitle(titleValues[indexPath.row], for: .normal)
cell.applyButton.isEnabled = titleValues[indexPath.row] == "Schedule"