I want to make an “are you sure”-alert that pops up when the user touches a “reset highscore”-button.
I’ve searched the internet and have written the following code:
let alert = UIAlertController(title: "Reseting", message: "Are you sure?", preferredStyle: UIAlertControllerStyle.ActionSheet) alert.addAction(UIAlertAction(title: "Yes", style: .Destructive, handler: alertButtonHandler))
I still don’t know how to make the alert appear.
Also, the handler is just a block of code written as a function. I haven’t really figured out how it works.
The given code is written inside a
I don’t have a storyboard. Thus, I’m creating the button programatically.
In advance, thanks!