Never Nop Tech

Never Nop Tech

創造意義,動手去做。

swift show dialog

swift show dialog

DEMO:

Code:

@IBAction func actionSheetButtonPressed(sender: UIButton) {
let alert = UIAlertController(title: “My Alert", message: “This is an action sheet.", preferredStyle: .Alert) 
let firstAction = UIAlertAction(title: “one", style: .Default) { (alert: UIAlertAction!) -> Void in
NSLog(“You pressed button one")
} /let secondAction = UIAlertAction(title: “two", style: .Default) { (alert: UIAlertAction!) -> Void in
NSLog(“You pressed button two")
alert.addAction(firstAction) 
alert.addAction(secondAction)
presentViewController(alert, animated: true, completion:nil)
}