0

hi I've created an iphone app. I am using 5 tab bar items. By default, when app gets launched, it shows up first tabbar. What i want to do is to display 3rd tab bar when application is launched. How can i do that?

Best regards, Abdul qavi

Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97
aqavi_paracha
  • 1,131
  • 2
  • 17
  • 38

2 Answers2

1

In the application didFinishLaunchingWithOptions method of your AppDelegate, some time before the end, add the indicated line.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    . . . 

    // Add this line
    tabcontroller.selectedIndex = 2;

    [window addSubview:tabcontroller.view];
    [window makeKeyAndVisible];
    return YES;
}

Note that the 2 is the tab to switch to, starting with 0 for the first tab.

Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97
  • It worked for me. Thank u so much, both Suria and Matthew. It was so simple, but i am iphone newbie... – aqavi_paracha Dec 09 '10 at 11:20
  • Glad it worked for you. Be sure to accept one of the answers by clicking the checkmark next to it. This lets others know that the question has been answered and is important for your reputation, especially when you want a question answered in the future. – Matthew Frederick Dec 09 '10 at 11:25
0

just set the selectedItem property of the tabbar to the number you want to show up.

hAPPY iCODING....

Suresh Varma
  • 9,750
  • 1
  • 60
  • 91