Reputation: 621
I am trying to make tab bar's items to start from the right. I mean like:
A tab of objects:
1 2 3 4
Would be like:
4 3 2 1
But when i do it visually it makes it:
1 2 3 4
when the items look visualy as:
4 3 2 1
I want it to open with the 1 on (the rightest option)
Any help will be helpfull ! Thanks :)
Upvotes: 0
Views: 778
Reputation: 302
Order your tab bar items, if its in the xib file or if it was create programmatically in code. To set the first tab to be on the left side set the tabbar controller selected item at index 0, and if you want it to start from right set index at the last tabbar item.
Upvotes: 0
Reputation: 10329
Ok, what you do is ignore the settings in you interfacebuilder.
In your AppDelegate.m
you are initiating the UITabbarController
most likely... and change it to something like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UIViewController *viewController3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
UIViewController *viewController4 = [[FourthViewController alloc] initWithNibName:@"FourthViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController4, viewController3, viewController2, viewController1];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
This should make your tabs show in the order 4, 3, 2, 1.
Upvotes: 1