这个popover类的名称是什么? [英] What is the name of this popover class?
本文介绍了这个popover类的名称是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找不到这个' popover
'的类名。 Apple在他们的应用程序中经常使用它。
I cannot find the name of the class for this 'popover
'. Apple uses it a lot in their applications.
我搜索了 popover
, NSAlert
,自定义隐藏/可见视图等等。
I've searched for popover
, NSAlert
, custom hidden/visible views, and many more.
它叫什么?
推荐答案
这是 UIAlertController
。在ios7之前,它被称为 UIActionSheet
This is UIAlertController
. Before ios7 it is know as UIActionSheet
A UIAlertController
对象向用户显示警报消息。此类替换UIActionSheet和UIAlertView类以显示警报。
A UIAlertController
object displays an alert message to the user. This class replaces the UIActionSheet and UIAlertView classes for displaying alerts.
@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)
}
输出:
可能是它会帮助你。
这篇关于这个popover类的名称是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文