import UIKitclass BusinessMainController: BaseTableViewController {override func viewDidLoad() {super.viewDidLoad()self.title = "业务类"//定义按钮,显示最简单的Alterlet button1 = UIButton(type: UIButton.ButtonType.system)button1.frame = CGRect(x: 30, y: 70, width: self.view.frame.size.width-60, height: 35)button1.setTitle("最简单的Alter", for: UIControl.State.normal)button1.addTarget(self, action: #selector(button1Action), for: UIControl.Event.touchUpInside)self.view .addSubview(button1)}@objc func button1Action() {let alterController = UIAlertController(title: "最简单的Alter", message: nil, preferredStyle: UIAlertController.Style.alert)let action1 = UIAlertAction(title: "星期一", style: UIAlertAction.Style.default) { (UIAlertAction) -> Void in}let action2 = UIAlertAction(title: "星期二", style: UIAlertAction.Style.destructive) { (UIAlertAction) -> Void in}let action3 = UIAlertAction(title: "星期三", style: UIAlertAction.Style.default) { (UIAlertAction) -> Void in}let action4 = UIAlertAction(title: "取消", style: UIAlertAction.Style.cancel) { (UIAlertAction) -> Void in}alterController.addAction(action1)alterController.addAction(action2)alterController.addAction(action3)alterController.addAction(action4)self.present(alterController, animated: true, completion: nil)}@objc func button2Action() {let alterController = UIAlertController(title: "带文本框的Alter", message: nil, preferredStyle: UIAlertController.Style.alert)alterController.addTextField { (textField: UITextField) -> Void intextField.placeholder = "请输入账号"}alterController.addTextField { (textField: UITextField) -> Void intextField.placeholder = "请输入密码"textField.isSecureTextEntry = true}let action = UIAlertAction(title: "登录", style: UIAlertAction.Style.cancel) { (UIAlertAction) -> Void in}alterController.addAction(action)self.present(alterController, animated: true) { () -> Void in}}@objc func button3Action() {let alterController = UIAlertController(title: "最简单的Alter", message: nil, preferredStyle: UIAlertController.Style.actionSheet)let action1 = UIAlertAction(title: "星期一", style: UIAlertAction.Style.default) { (UIAlertAction) -> Void in}let action2 = UIAlertAction(title: "星期二", style: UIAlertAction.Style.destructive) { (UIAlertAction) -> Void in}let action3 = UIAlertAction(title: "星期三", style: UIAlertAction.Style.default) { (UIAlertAction) -> Void in}let action4 = UIAlertAction(title: "取消", style: UIAlertAction.Style.cancel) { (UIAlertAction) -> Void in}alterController.addAction(action1)alterController.addAction(action2)alterController.addAction(action3)alterController.addAction(action4)self.present(alterController, animated: true, completion: nil)}}