美文网首页Swift
swift UIAlertController实现

swift UIAlertController实现

作者: 江河_ios | 来源:发表于2020-06-16 14:56 被阅读0次

iOS8.0以上,苹果建议使用UIAlertController

    let alertView = UIAlertController.init(title: "提示", message: "信息", preferredStyle: .alert)

    let alert = UIAlertAction.init(title: "确定", style: .destructive) { (UIAlertAction) in
                  print("确定按钮点击")
    }
    let cancleAlert = UIAlertAction.init(title: "取消", style: .cancel) { (UIAlertAction) in
        
        print("点击取消按钮")
    }
    alertView.addAction(cancleAlert)

    alertView.addAction(alert);

    self.present(alertView, animated: true, completion: nil)

相关文章

网友评论

    本文标题:swift UIAlertController实现

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