I have a custom cell that has a stackview that contains several buttons. I need to be able to show each button depending on a data item. for example in one cell three buttons will appear, in another 4 different buttons appear, in another all buttons. The cell looks like this:
As a test, I tried the code below to set the buttons:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "doctrineCell", for: indexPath) as! DoctrineCell
let doctrine = doctrines[indexPath.row]
cell.doctrineLabel.text = doctrine.doctrineText!
cell.bofmButton.isHidden = true
cell.otButton.isHidden = true
cell.ntButton.isHidden = true
cell.ldaButton.isHidden = true
cell.ldpButton.isHidden = true
cell.pbutton.isHidden = true
cell.jsbutton.isHidden = true
cell.allButton.isHidden = true
cell.ldaButton.isHidden = false
cell.ldpButton.isHidden = false
cell.pbutton.isHidden = false
return cell
}
When I run the app all buttons show.
How do I control what buttons are displayed?