Monday 15 August 2011

swift - UIAlertView displays alert showing late than when required ios -



swift - UIAlertView displays alert showing late than when required ios -

i using uialertview display alert , working first time when click alert appears when sec time on clicking twice alert gets displayed instead of 1st click.

during secong time "visited full" gets printed on !st click alert appears on 2click, why appear?please help me resolve.thanks in advance

println("visited full") var alert:uialertview = uialertview(title: "video", message: "you have played videos", delegate: self, cancelbuttontitle: "ok") alert!.show()

if doesn't work seek may work.

let alert = uialertcontroller(title: "video", message: "you have played videos", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "ok", style: uialertactionstyle.default, handler: nil)) self.presentviewcontroller(alert, animated: true, completion: nil)

edit: think can utilize way too:

dispatch_async(dispatch_get_main_queue(), { var alert:uialertview = uialertview(title: "video", message: "you have played videos", delegate: self, cancelbuttontitle: "ok") alert.show() })

and uialertcontroller

dispatch_async(dispatch_get_main_queue(), { allow alert = uialertcontroller(title: "video", message: "you have played videos", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "ok", style: uialertactionstyle.default, handler: nil)) self.presentviewcontroller(alert, animated: true, completion: nil) })

ios swift uialertview

No comments:

Post a Comment