by joe.pesch
5. January 2019 12:40
There are two steps to add a working button to a table view cell. The first step is to add a button like this:
cell.accessoryType = .detailDisclosureButton
The second step is to take action when the button is tapped by creating the accessoryButtonTappedForRowWith
method:
override func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
doSomethingWithItem(indexPath.row)
}
a518e0aa-d7d1-4405-a2b8-074794588672|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags:
XCode | iOS | Swift