Created
March 3, 2019 10:36
-
-
Save bigimot22/1beab29fd2f1ceb1678e0c774a9efd28 to your computer and use it in GitHub Desktop.
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
func showMyAlert() { | |
//1 | |
let alerta = UIAlertController(title: "Mi título", message: "Mi mensaje para el usuario.", preferredStyle: .alert) | |
//2 | |
alerta.addAction(UIAlertAction(title: "Cerrar", style: .default, handler: nil)) | |
//3: | |
//Acción con función en linea (closure) | |
alerta.addAction(UIAlertAction(title: "Otra opción", style: .default, handler: { miAccion in | |
// escribir debajo la funcionalidad deseada. | |
print("Hemos escogido otra opción") })) | |
//4 | |
self.present(alerta, animated: true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment