objective c - Create a simple Alert in swift -
it looks alertstatus cannot used in swift.
can guys please me implementing alternative solution code below?
[self alertstatus:@"message!" :@"alert title" :0];
try following code
let alert = uialertview() alert.title = "title" alert.message = "my message" alert.addbuttonwithtitle("ok") alert.show()
but in ios 8
uialertview
deprecated. use uialertcontroller
preferredstyle
of uialertcontrollerstylealert
. should
var alert = uialertcontroller(title: "title", message: "message", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "ok", style: uialertactionstyle.default, handler: nil)) self.presentviewcontroller(alert, animated: true, completion: nil)
Comments
Post a Comment