美文网首页
Swift的弹框

Swift的弹框

作者: xieyinghao | 来源:发表于2018-12-14 15:06 被阅读8次
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)

相关文章

网友评论

      本文标题:Swift的弹框

      本文链接:https://www.haomeiwen.com/subject/badghqtx.html