Swift显示alert和promp confirmation

Swift显示alert和promp confirmation,第1张

概述Swift 显示alert func Alert(title:String, msg:String)->Void{ let alert = UIAlertController(title: title, message: msg, preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAler

Swift 显示alert


func Alert(Title:String,msg:String)->VoID{        let alert = UIAlertController(Title: Title,message: msg,preferredStyle: UIAlertControllerStyle.alert)        alert.addAction(UIAlertAction(Title: "Ok",style: UIAlertActionStyle.default,handler: nil))        self.present(alert,animated: true,completion: nil)    }

Swift 显示confirmation


let refreshAlert = UIAlertController(Title: "",message: "Are you sure to continue?".localized(),preferredStyle: UIAlertControllerStyle.alert)                        refreshAlert.addAction(UIAlertAction(Title: "Yes".localized(),style: .default,handler: { (action: UIAlertAction!) in                // Cancel leave                let result = ServiceProxy().CallCancelLeave(leaveID: self._leave.ID)                if(!result.isSuccess){                    self.Alert(Title: "Error".localized(),msg: result.errorMessage)                }else{                    // do nothing and navigate to the List vIEw                }            }))                        refreshAlert.addAction(UIAlertAction(Title: "No".localized(),style: .cancel,handler: { (action: UIAlertAction!) in                // do nothing            }))            present(refreshAlert,completion: nil)
总结

以上是内存溢出为你收集整理的Swift显示alert和promp confirmation全部内容,希望文章能够帮你解决Swift显示alert和promp confirmation所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1060774.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存