iOS UIAlertController

UIAlertController

UIAlertController is new UI class of iOS. This is equivalent for UIAlert, UIAlert is deprecated in iOS8.

Example(swift)

var alert : UIAlertController!  = UIAlertController(title: "Test", message: "Thanks", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (UIAlertAction) -> Void in
   NSLog("YES")
}))
        
alert.addAction(UIAlertAction(title: "NO", style: UIAlertActionStyle.Cancel, handler: { (UIAlertAction) -> Void in
   NSLog("NO")
}))
        
self.presentViewController(alert, animated: true, completion: nil)