Well, if you want to do this programmatically, then I would suggest replacing each of your viewControllers in your UITabBar with UINavigationControllers that house the respective view controllers.
So, your old code looks something like this:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UITabBarController *tbc = [[[UITabBarController alloc]init]autorelease];
[window addSubview:tbc.view];
UIViewController *mapVC = [[[UIViewController alloc] init]autorelease];
NSArray *tabViewControllerArray = [NSArray arrayWithObjects:self.mapVC, nil];
tbc.viewControllers = tabViewControllerArray;
}
New code should be:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UITabBarController *tbc = [[[UITabBarController alloc]init]autorelease];
[window addSubview:tbc.view];
UIViewController *mapVC = [[[UIViewController alloc] init]autorelease];
// add the viewController to a UINavigationController
UINavigationController *mapNav = [[[UINavigationController alloc] initWithRootViewController:mapVC]autorelease];
// put the nav controller in the array instead
NSArray *tabViewControllerArray = [NSArray arrayWithObjects:mapNav, nil];
tbc.viewControllers = tabViewControllerArray;
// this code adds a right button to the mapBav navigationBar
// this uses a custom view, but you could use a standard UIBarButtonItem too
NSArray *items = [NSArray arrayWithObjects: [UIImage imageNamed:@"flag-icon.png"], nil];
UISegmentedControl *tableControl = [[[UISegmentedControl alloc] initWithItems:items]autorelease];
tableControl.segmentedControlStyle = UISegmentedControlStyleBar;
UIBarButtonItem *segmentBarItem = [[[UIBarButtonItem alloc] initWithCustomView:tableControl] autorelease];
self.navigationItem.rightBarButtonItem = segmentBarItem;
}