ios - Presenting a UIViewController without animation shows the presenter UIViewController for an istant -


// appdelegate.swift  let navigationcontroller = uinavigationcontroller() self.window = uiwindow(frame: uiscreen.main.bounds) self.window!.rootviewcontroller = navigationcontroller self.window!.makekeyandvisible()  let homeviewcontroller = homeviewcontroller() navigationcontroller.pushviewcontroller(homeviewcontroller, animated: false) if !isloggedin {     let authviewcontroller = authviewcontroller()     navigationcontroller.present(authviewcontroller, animated: false) } 

i have situation similar this. if no user authenticated, want show authentication screen. code above works problem that, fraction of second, can see homeviewcontroller before authviewcontroller presented modally without animation. how can prevent that?

here's gif showing problem.

animation

edit: wouldn't want use , if/else statement. homeviewcontroller sit underneath authviewcontroller.

// appdelegate

  -(void)launchscreen{     uistoryboard * storyboard = [uistoryboard storyboardwithname:@"main" bundle:[nsbundle mainbundle]];          if ([[nsuserdefaults standarduserdefaults] valueforkey:userid])         {             // here show dashboard or loggedin screen         }else{              // here show login screen or authentication screen          }                                                                             }   

Comments

Popular posts from this blog

vue.js - Create hooks for automated testing -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

serial port - hub4com OVERRUN Error -