views:

184

answers:

3

Hi

I am developing an iPhone tabbar application with 5 tabs .

I want to show only two tabs at the launch time such as one is "locate me".

When the user taps on the locate me tab another 3 tabs will be shown and can use the current location.

I want to do some thing like "urban spoon" .

I am using the interface builder for all the stuff.

If any one have any idea , suggestion , links then provide me.

Thanks .

+2  A: 

-[UITabBarController setViewControllers:] => You can give the tab bar controller a new array of view controllers, and it will replace its existing tabs with new tabs that correspond to the view controllers in the new array.

Dave DeLong
can you give me sample code or any example link . i have searched a lot but can't find .
hib
+1  A: 
// Make array which includes your existing view controllers
NSMutableArray *newVCs = [NSMutableArray arrayWithArray:[yourTabBarController viewControllers]];

// First new VC you want to add (example from a nib)
[newVCs addObject:[[[SomeCustomViewController alloc] initWithNibName:@"yourNibName" bundle:[NSBundle mainBundle]] autorelease]];

// Second new VC you want to add (example for a VC generated from code)
[newVCs addObject:[[[AnotherCustomViewController alloc] initWithNibName:nil bundle:nil] autorelease]];

// Third new VC you want to add (example from IBOutlet)
[newVCs addObject:self.yetAnotherViewController];

// Set the tab bar's view controllers to your new modified array
[yourTabBarController setViewControllers:newVCs];
Victorb
A: 

This is not an answer but question for more details on how to make it work - I've a similar situation, where would you place all these codes to change from having 2 tab bar items to 5 tab items after the application has already been launched?

yojc