最佳答案
这是 UIAlertController
。在 ios7 之前它被称为 UIActionSheet
UIAlertController
对象向用户显示警告消息。此类替换了用于显示警报的 UIActionSheet 和 UIAlertView 类。
@IBAction func showActionSheetTapped(sender: AnyObject) {
//Create the AlertController
let actionSheetController: UIAlertController = UIAlertController(title: "Action Sheet", message: "Swiftly Now! Choose an option!", preferredStyle: .ActionSheet)
//Create and add the Cancel action
let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in
//Just dismiss the action sheet
}
actionSheetController.addAction(cancelAction)
//Create and add first option action
let takePictureAction: UIAlertAction = UIAlertAction(title: "Take Picture", style: .Default) { action -> Void in
//Code for launching the camera goes here
}
actionSheetController.addAction(takePictureAction)
//Create and add a second option action
let choosePictureAction: UIAlertAction = UIAlertAction(title: "Choose From Camera Roll", style: .Default) { action -> Void in
//Code for picking from camera roll goes here
}
actionSheetController.addAction(choosePictureAction)
//Present the AlertController
self.presentViewController(actionSheetController, animated: true, completion: nil)
}
输出:
也许它会对你有所帮助。
关于ios - 这个弹出窗口类的名称是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33515641/