Last active
October 11, 2016 19:51
-
-
Save nickmeehan/8ed7b0604e7ec2bbbe64cdcc5f9f0d22 to your computer and use it in GitHub Desktop.
iPhone ActionSheet Presentation
This file contains 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
@IBAction func showDeleteActionSheet(_ sender: AnyObject) { | |
let alertController = UIAlertController(title: nil, message: "Alert message.", preferredStyle: .actionSheet) | |
let defaultAction = UIAlertAction(title: "Default", style: .default, handler: { (alert: UIAlertAction!) -> Void in | |
// Do some action here. | |
}) | |
let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (alert: UIAlertAction!) -> Void in | |
// Do some destructive action here. | |
}) | |
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: { (alert: UIAlertAction!) -> Void in | |
// Do something here upon cancellation. | |
}) | |
alertController.addAction(defaultAction) | |
alertController.addAction(deleteAction) | |
alertController.addAction(cancelAction) | |
self.present(alertController, animated: true, completion: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment