8

My root view is a tab bar controller, I would like to open the app on a specific tab when a certain notification is received. If I use presentViewController the tab bar disappears. Is there a specific way to do this?

Mr Mike
  • 337
  • 3
  • 12

1 Answers1

12
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    let myTabBar = self.window.rootViewController as! UITabBarController // Getting Tab Bar
    myTabBar.selectedIndex = 2 //Selecting tab here
    return true
}
Dmitry
  • 2,963
  • 2
  • 21
  • 39