views:

128

answers:

1

I have a UITabBarController with two different views to switch between. What I would like to do is when a button is clicked in View1 to switch directly to View2. Then in View2 if they click a button it switches them to View1.

It transfers between View1 and View2 when they click on the tabBarController fine but I'm trying to perform the switching for them when events occur.

Is there a way to do this by calling a method on my UITabBarController?

@interface CalcAppDelegate : NSObject <UIApplicationDelegate> {
UITabBarController *tabBarController;

}

+1  A: 

Simply do wherever you want to do this,

CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDel.tabBarController setSelectedIndex:theIndexOfTabItem];

Hope this helps.

Thanks,

Madhup

Madhup
Thank you for the response Madhup. It worked wonderfully.
aahrens