显示AlerView在斯威夫特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)
}
您可以在您的视图呈现视图控制器如果你的观点只被已在导航堆栈... – holex