i'm trying add ok button ui alert cannot add using alertcontroller.addaction
what do in case?
thanks in advance!!
if error == nil { let alert: uialertcontroller = uialertcontroller(title: "account created", message: "please confirm email", preferredstyle: .alert) let okbutton = uialertaction(title: "ok", style: .default) { action -> void in self.performseguewithidentifier("tomain", sender: self) alertcontroller.addaction(okbutton) self.presentviewcontroller(alert, animated: true, completion: nil) } } else { println("\(error)") }
alertinstead ofalertcontrolleralert.addactionshould outside ofokbuttonaction.
change code :
if error == nil { let alert: uialertcontroller = uialertcontroller(title: "account created", message: "please confirm email", preferredstyle: .alert) let okbutton = uialertaction(title: "ok", style: .default) { action -> void in self.performseguewithidentifier("tomain", sender: self) } alert.addaction(okbutton) self.presentviewcontroller(alert, animated: true, completion: nil) } else { println("\(error)") }
Comments
Post a Comment