1

In the app FIRSTViewController is initial View Controller set from storyboard. Login, Register, etc option available there. Login screen is presented from it:

let destVC = self.storyboard?.instantiateViewControllerWithIdentifier("LoginIdentifier")
self.presentViewController(destVC!, animated: true, completion: nil)

When user logged in successfully, redirect it to TabViewController:

let desViewController = selfVC.storyboard!.instantiateViewControllerWithIdentifier("UITabBarController") as! UITabBarController
    UIApplication.sharedApplication().keyWindow?.rootViewController = desViewController

Above code is working fine, but issue is: When redirection to tab view is happening, initial view controller(FIRSTViewController) is display for one or half second before display tabbar.

So, my question is: How can i prevent initial view controller from display?

GSL
  • 23
  • 4
  • The issue is first you dismiss the presented ViewController, after that you set `UITabBarController` as rootViewController – Bala Jun 15 '17 at 13:15

1 Answers1

0

That's may happen because of this code was executed after InitialViewController loaded

 let desViewController = selfVC.storyboard!.instantiateViewControllerWithIdentifier("UITabBarController") as! UITabBarController
    UIApplication.sharedApplication().keyWindow?.rootViewController = desViewController

To fix that issue you must not set FirstViewController as Initial, you can set some Other "empty" View Controller as Initial and redirect to Login/register or on Tab ViewController, in Initial ViewController you can set ImageView to screen with lunch image, so user will not know that some controller was showen, its will look like lunch screen is steel showing.

Arthur Sahakyan
  • 566
  • 3
  • 17
  • Thanks, but we don't want to show any other blank view controller or any other lunch image view when redirection from login to tabbar controller. – GSL Jun 16 '17 at 06:01