ios - How to show alert view once in view controller in Swift 3? -
this question has answer here:
- how stuff in viewdidappear once? 8 answers
i creating app when user enters page, alert view pops saying "click on button proceed". how can make alert view show once in view controller? help.
override func viewdidappear(_ animated: bool) { super.viewdidappear(animated) let alertcontroller = uialertcontroller(title: "info", message: "click on button proceed", preferredstyle: uialertcontrollerstyle.alert) let mybacksign = uialertaction(title: "ok", style: uialertactionstyle.default, handler: nil) alertcontroller.addaction(mybacksign ) self.present(alertcontroller, animated: true, completion: nil) }
viewwillappear , viewdidappear called every time view displayed.
if want call method invoked once viewdidload.
viewdidload called once when view loaded memory.
use viewdidload.
Comments
Post a Comment