Swift的弹框

let alertController = UIAlertController(title: "系统提示", message: "您确定要离开吗", preferredStyle: UIAlertControllerStyle.alert)
            let cancelAction = UIAlertAction(title: "取消", style: UIAlertActionStyle.cancel, handler: nil )
            let okAction = UIAlertAction(title: "确定", style: UIAlertActionStyle.default) { (ACTION) in
                print("确定")
                
            }
            alertController.addAction(cancelAction);
            alertController.addAction(okAction);
            self.present(alertController, animated: true, completion: nil)


let alertController = UIAlertController(title: "系统提示", message: "您确定要删除吗", preferredStyle: .actionSheet)
            let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
            let deleteAction = UIAlertAction(title: "删除", style: .destructive, handler: nil)
            let archiveAction = UIAlertAction(title: "保存", style: .default, handler: nil)
            alertController.addAction(cancelAction)
            alertController.addAction(deleteAction)
            alertController.addAction(archiveAction)
            self.present(alertController, animated: true, completion: nil)

推荐阅读更多精彩内容