func displayAlert(title:String, content:String) {
var alertController = UIAlertController(
title: title,
message: content,
preferredStyle: UIAlertControllerStyle.Alert)
var okAction = UIAlertAction(
title: "OK", style: UIAlertActionStyle.Default) {
(action) -> Void in
println("Tapped on OK")
}
alertController.addAction(okAction)
self.presentViewController(alertController, animated: true, completion: nil)
}
To display an alert, you can call the displayAlert() function like this:
self.displayAlert("Hello", content: "Hello, iOS 8")
The above will display an alert like the following:
No comments:
Post a Comment