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?
Instead of PushView Controller Use presentViewController Try this Code
override func viewDidLoad() {
super.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.present(navigationController, animated: true, completion: nil)
}
First of all in storyboard make custom class view controller as Initial view controller
. And after that push tabbar
controller to current navigation controller
.
let tabBar = self.storyboard!.instantiateViewControllerWithIdentifier("tabBarViewController") as! UITabBarController tabBarVC.selectedIndex = 0
self.navigationController?.pushViewController(tabBar, animated: true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With