Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab bar & Storyboard : Change the default tab

I have a tab bar in my storyboard, and 5 tabs.

I want my app to load on the middle tab but I can't find how to do it and where to do it.

like image 618
Thib L Avatar asked Dec 09 '22 22:12

Thib L


1 Answers

I found the answer !

In appDelegate.m :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UITabBarController *tabBar = (UITabBarController *)self.window.rootViewController;
tabBar.selectedIndex = 2;
return YES;
}

Hope it will help !

like image 159
Thib L Avatar answered Dec 19 '22 15:12

Thib L