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所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)