うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

How to set initial selected tab

Japanese here uchinoinu.hatenablog.jp

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        let tabBar = self.window!.rootViewController as! UITabBarController
        tabBar.selectedIndex = 1 // Set index number which you want to select

        return true
    }