I'm currently trying to replicate the array you can see below in the picture:
I've created a custom cell class so I can display a label and a switch button. The part I have no idea about is how to display the legend below every cell.
Here is my code at the moment:
var options = ["Solstice", "Equinox", "Enable Snapshot"]
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return options.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomCell", for: indexPath) as! CustomCell
let switchView = UISwitch(frame: CGRect.zero)
cell.addSubview(switchView)
cell.accessoryView = switchView
cell.nameLabel.text = options[indexPath.row]
return cell
}
Could the legend be another custom cell, with a different style? What would be the best way to do it?