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.
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
Post a Comment