Im try to simply call a function called "GoToNewShoot" When the user press the "ok" button when the Alert pops up Thanks!.
Code:
@IBAction func GobacktoCamera(sender: AnyObject) {
var alertController = UIAlertController(title: "Just Checking", message: "Are You Sure You Want to Start over ", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Cancel, handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
One useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen. Before this function can work, we must first call the showAlert() function. JavaScript functions are called in response to events.
The alert() method displays an alert box with a message and an OK button. The alert() method is used when you want information to come through to the user.
The alert() method in JavaScript is used to display a virtual alert box. It is mostly used to give a warning message to the users. It displays an alert dialog box that consists of some specified message (which is optional) and an OK button. When the dialog box pops up, we have to click "OK" to proceed.
You can add HTML into an alert string, but it will not render as HTML.
You can do it by using handler from addAction
this way:
@IBAction func GobacktoCamera(sender: AnyObject) {
var alertController = UIAlertController(title: "Just Checking", message: "Are You Sure You Want to Start over", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Yes", style: .Default, handler: { action in
//run your function here
self.GoToNewShoot()
}))
self.presentViewController(alertController, animated: true, completion: nil)
}
func GoToNewShoot(){
println("Method Called")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With