Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a specific Tab View from AppDelegate

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?

like image 256
Mr Mike Avatar asked Aug 27 '16 12:08

Mr Mike


1 Answers

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
}
like image 141
Dmitry Avatar answered Oct 22 '22 11:10

Dmitry