这个popover类是什么名字?
我无法find这个“ popover
”类的名字。 苹果在他们的应用中使用了很多。
我search了popover
, NSAlert
,自定义隐藏/可见视图等等。
这叫什么?
这是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) }
输出:
可能会帮助你。