swift - Content under a login View is visible for a fraction of second -


i have view displaying content, password protected. in viewwillappear variable gets checked, see if user logged in :

override func viewwillappear(animated: bool) {      if (!config.userloggedin) {     let storyboard = uistoryboard(name: "main", bundle: nil)     let loginvc = storyboard.instantiateviewcontrollerwithidentifier("loginvc") as! uiviewcontroller     loginvc.modaltransitionstyle = uimodaltransitionstyle.crossdissolve     self.navigationcontroller!.presentviewcontroller(loginvc ,animated: true, completion: nil)   } } 

it works, content underneath visible short fraction of second. how can present loginvc without revealing content underneath. cannot put in viewdidloadbecause part of tabbarcontroller, , views might in memory , viewdidload called once

simple solution. hide whole view in viewdidload show in viewviewappear if user correctly logged in

override func viewdidload(){     self.view.hidden = true }  override func viewwillappear(animated: bool) {      if (!config.userloggedin) {         let storyboard = uistoryboard(name: "main", bundle: nil)         let loginvc = storyboard.instantiateviewcontrollerwithidentifier("loginvc") as! uiviewcontroller         loginvc.modaltransitionstyle = uimodaltransitionstyle.crossdissolve         self.navigationcontroller!.presentviewcontroller(loginvc ,animated: true, completion: nil)     }else{          self.view.hidden = false     } } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -