tableView(_:didSelectRowAt:)
Tells the delegate a row is selected.
Declaration
optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)Parameters
- tableView:
A table view informing the delegate about the new row selection.
- indexPath:
An index path locating the new selected row in
tableView.
Mentioned in
Discussion
The delegate handles selections in this method. For instance, you can use this method to assign a checkmark (UITableViewCell.AccessoryType.checkmark) to one row in a section in order to create a radio-list style. The system doesn’t call this method if the rows in the table aren’t selectable. See Handling row selection in a table view for more information on controlling table row selection behavior.
See Also
Responding to row selections
Handling row selection in a table viewSelecting multiple items with a two-finger pan gesturetableView(_:willSelectRowAt:)tableView(_:willDeselectRowAt:)tableView(_:didDeselectRowAt:)tableView(_:shouldBeginMultipleSelectionInteractionAt:)tableView(_:didBeginMultipleSelectionInteractionAt:)tableViewDidEndMultipleSelectionInteraction(_:)