Question

In my app I usually want to start the user in the first tab bar (as set up in Storyboard). However depending on certain settings, I want to select another tab whenever the app is loaded or just enters the foreground again. How can I do this in the app delegate?

Was it helpful?

Solution

Use this in App delegate didFinishLaunchingWithOptions method for selecting particular tab index.

UITabBarController *tabController = (UITabBarController*)self.window.rootViewController;
tabController.selectedIndex = selectedTabIndex;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top