Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Use tableView(_:didSelectRowAt:) to manage what happens when a user selects a UITableViewCell.
- // This example exhibits how this app makes use of this method.
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- // Determine what to do when a cell in a particular section is selected.
- switch indexPath.section {
- case 0:
- // If the cell in the first section is selected, this will trigger the segue with the "toHeightForRowAt" identifier
- self.performSegue(withIdentifier: "toHeightForRowAt", sender: nil)
- case 1:
- // Create an alert if the cell in the "Managing Selections" section is selected.
- let alert = UIAlertController(title: "Alert", message: "This alert is fired when you select the didSelectRowAt cell.", preferredStyle: .alert)
- // Create an action do dismiss the Alert Controller.
- alert.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: nil))
- // Create an action that triggers a segue with the identifier "toDidSelectRowAt". That's how you got to this web
- // page!
- alert.addAction(UIAlertAction(title: "Continue to GitHub to see how this is done.", style: .default, handler: { _ in
- self.performSegue(withIdentifier: "toDidSelectRowAt", sender: nil)
- }))
- // Don't forget to present the alert controller!
- self.present(alert, animated: true, completion: nil)
- case 2:
- // If the cell in the third section is selected, this will trigger the segue with the "toEditActionsForRowAt"
- // identifier
- self.performSegue(withIdentifier: "toEditActionsForRowAt", sender: nil)
- default:
- print("Out of index")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement