Last active
May 30, 2018 07:27
-
-
Save BalajiMalliswamy/b249a90ddc55b810382c93a5027740af to your computer and use it in GitHub Desktop.
Exploring UIAlertController in swift
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
/** | |
Simple Action Sheet | |
- Show action sheet with title and alert message and actions | |
*/ | |
func showSimpleActionSheet(controller: UIViewController) { | |
let alert = UIAlertController(title: "Title", message: "Please Select an Option", preferredStyle: .actionSheet) | |
alert.addAction(UIAlertAction(title: "Approve", style: .default, handler: { (_) in | |
print("User click Approve button") | |
})) | |
alert.addAction(UIAlertAction(title: "Edit", style: .default, handler: { (_) in | |
print("User click Edit button") | |
})) | |
alert.addAction(UIAlertAction(title: "Delete", style: .destructive, handler: { (_) in | |
print("User click Delete button") | |
})) | |
alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: { (_) in | |
print("User click Dismiss button") | |
})) | |
self.present(alert, animated: true, completion: { | |
print("completion block") | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment