ios - How to show alert view once in view controller in Swift 3? -


this question has answer here:

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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -