Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. // Use tableView(_:didSelectRowAt:) to manage what happens when a user selects a UITableViewCell.
  2. // This example exhibits how this app makes use of this method.
  3.  
  4. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  5.  
  6. // Determine what to do when a cell in a particular section is selected.
  7. switch indexPath.section {
  8. case 0:
  9. // If the cell in the first section is selected, this will trigger the segue with the "toHeightForRowAt" identifier
  10. self.performSegue(withIdentifier: "toHeightForRowAt", sender: nil)
  11. case 1:
  12. // Create an alert if the cell in the "Managing Selections" section is selected.
  13. let alert = UIAlertController(title: "Alert", message: "This alert is fired when you select the didSelectRowAt cell.", preferredStyle: .alert)
  14. // Create an action do dismiss the Alert Controller.
  15. alert.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: nil))
  16.  
  17. // Create an action that triggers a segue with the identifier "toDidSelectRowAt". That's how you got to this web
  18. // page!
  19. alert.addAction(UIAlertAction(title: "Continue to GitHub to see how this is done.", style: .default, handler: { _ in
  20. self.performSegue(withIdentifier: "toDidSelectRowAt", sender: nil)
  21. }))
  22.  
  23. // Don't forget to present the alert controller!
  24. self.present(alert, animated: true, completion: nil)
  25.  
  26. case 2:
  27. // If the cell in the third section is selected, this will trigger the segue with the "toEditActionsForRowAt"
  28. // identifier
  29. self.performSegue(withIdentifier: "toEditActionsForRowAt", sender: nil)
  30. default:
  31. print("Out of index")
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement