Last active
December 11, 2017 23:39
-
-
Save jasonhilimire/c0dff5e1fcef4dabc7ba1b0ab3d19331 to your computer and use it in GitHub Desktop.
[UIAlertController] How to show An Alert Controller #swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let alertController = UIAlertController(title: "Warning!", message: "This will DELETE all your Shot Cycles data!! This cannot be undone", preferredStyle: .alert) | |
| let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { action in | |
| print("Cancel button pressed") | |
| } | |
| alertController.addAction(cancelAction) | |
| // maybe some stuff | |
| let deleteAction = UIAlertAction(title: "Delete", style: .destructive) { action in | |
| // some stuff | |
| // probably need this if using in a tableView self.tableView.reloadData() | |
| print("Delete button pressed") | |
| } | |
| alertController.addAction(deleteAction) | |
| self.present(alertController, animated: true) { | |
| // ... | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment