Show AlerView in swift for ios8
func showAlertVIew(){
var alert = UIAlertController(title: "Info", message: "Welcome to Swift world.", preferredStyle: UIAlertControllerStyle.Alert)
let alertOKAction=UIAlertAction(title:"OK", style: UIAlertActionStyle.Default,handler: { action in
println("OK Button Pressed")
})
let alertCancelAction=UIAlertAction(title:"Cancel", style: UIAlertActionStyle.Destructive,handler: { action in
println("Cancel Button Pressed")
})
alert.addAction(alertOKAction)
alert.addAction(alertCancelAction)
self.presentViewController(alert, animated: true, completion: nil)
}
source
share