Alertbox和迅速的3

问题描述:

动作片,我想选择的套餐类型,当我按下按钮。
三种包。

1. 包A
2. 包B
3. 套餐C

Alertbox和迅速的3

enter image description here

我混淆的如何实现此过程。我不知道它应该是警示框还是操作表?
我没有清楚地理解这一点。上图是行动表,不是吗?
但是,我发现,动作片的风格已经在iOS 8的被否决和更高版本。那么,我无法使用这个?
能否请您给我解释一下动作片和警告框之间的差异在迅速? 谢谢。

动作片和警报可以UIAlertController创建: 要创建你必须创建UIAlertController的一个实例的操作手册,并添加操作它: -

let actionSheet = UIAlertController(title: "Choose Package Type", message: nil , preferredStyle: .actionSheet) 
actionSheet.addAction(UIAlertAction(title: "Package A", style: .default, handler: nil)) 
actionSheet.addAction(UIAlertAction(title: "Package B", style: .default, handler: nil)) 
actionSheet.addAction(UIAlertAction(title: "Package C", style: .default, handler: nil)) 
actionSheet.addAction(UIAlertAction(title: "Cancel", style: .cancel , handler: { 
       (action: UIAlertAction) -> Void in 
       actionSheet.dismiss(animated: true, completion: nil) 
      })) 
present(actionSheet , animated: true , completion: nil) 

,可随时更换处理器,代之以#selector根据你的任务。