views:

1925

answers:

5

How can I set focus to different tabbar view on button click from first tabbar item? Thanks

+3  A: 

found the solution :

HelloWorldAppDelegate theDelegate = (HelloWorldAppDelegate)[[UIApplication sharedApplication] delegate]; tabController = theDelegate.tabBarController; tabController.selectedIndex = 1;

A: 

U missed the Pointer

L1AppAppDelegate *theDelegate = (L1AppAppDelegate*)[[UIApplication sharedApplication] delegate]; tabBarController = theDelegate.tabBarController; tabBarController.selectedIndex = 1;

Deepak Dhakal
A: 

hi, this method works when we are create tabbar on appdelegate view. how can we set focus when we are creating tabbar other than appDelegate.

A: 

Hi you all,

Try this!

self.tabBarController.selectedViewController = YOURTABBARITEMController; self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:1];

Do NOT forget to declare YOURTABBARController in the interface (.h), synthesize it, and #import the interface file into your .m file.

Plus for me I MYTABBARController was declared as @class in the interface too.

You can get this to work for you.... and look like a KING!!!

Eldon Poncsak
A: 

hi guys mind uploading images? to print screen in mac it's cmd + shift + 4 + space

hope to see some pictures as i dont get the final outcome

AlsonToh-SG