uitabbarcontroller - How to changed the selected tab items in the Tabbar in iphone? -
I created tab bar program in view controller In my application, the tabbar was initially displayed and in its view There are five tab bar items. Using tab bar, the first tab item is selected in the beginning. Now I want to change the chosen items like the fourth item has been selected at the beginning. (See image)
How do I get it?
Here is my code,
TBR = [[UITBbar Controller Elok] Init]; First = [[first light] initWithNibName: @ "first" bundle: zero]; UINavigationController * navFirst = [[[UINavigationController alloc] initWithRootViewController: First] Autorlage]; Second = [[Second Alok] initWithNibName: @ "Second" bundle: zero]; UINavigationController * navsecond = [[[UINavigationController alloc] initWithRootViewController: II] Autorlage]; Third = [[third alloc] initWithNibName: @ "third" bundle: zero]; UINavigationController * navthird = [[[UINavigationController alloc] initWithRootViewController: third] AutoCare]; Fourth = [[fourth alloc] initWithNibName: @ "fourth" bundle: zero]; UINavigationController * navfourth = [[[UINavigationController alloc] initWithRootViewController: Fourth] Autoreclass]; Fifth = [[Fifth Allent] initWithNibName: @ "Fifth" bundle: zero]; UINavigationController * navfifth = [[[UINavigationController alloc] initWithRootViewController: Fifth] autorelage]; TBar.viewControllers = [NSArray arrayWithObjects: navFirst, navsecond, navthird, navfourth, navfifth, zero]; [Self.view addSubview: tBar.view]; [Self. Navigation Push ViewController: Animated TBR: No];
See the image below
Thanks.
Try it out:
YourAppNameDelegate * AppDelegate = (YourAppNameDelegate *) [[UIApplication sharedApplication] delegate]; [App Delegate Tab Bark Controller] Select Index = 3;
or
tBar.selectedIndex = 3;
Comments
Post a Comment