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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -