Amelia frensheo Amelia frensheo - 1 year ago 113
iOS Question

How to initialise a custom splash screen before loading tab bar controller in storyboard?

I have an application in which i have a custom splash view controller and then the tab bar controller comes. Currently i have set the tab bar controller as the initial view controller . But i want the splash view controller appears first and then the tab bar controller . Any idea how to do this?

Answer Source
Instead of PushView Controller Use presentViewController

Try this Code

override func viewDidLoad() {

           _ = NSTimer.scheduledTimerWithTimeInterval(2.1, target: self, selector: #selector(Splash.someSelector), userInfo: nil, repeats: false)

            // Do any additional setup after loading the view.

        func someSelector() {

            let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
            let vc : TabBarCotroller = storyboard.instantiateViewControllerWithIdentifier("TabBarCotroller") as! TabBarCotroller

            let navigationController = UINavigationController(rootViewController: vc)

            self.presentViewController(navigationController, animated: true, completion: nil)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download