drfence
drfence

Reputation: 1567

UITabBarItems aren't centering in custom sized UITabBar

My UITabBarItems aren't showing up vertically centered in my UITabBar. I am using a custom sized background image for my UITabBar.

UITabBarController *tabController = [[UITabBarController alloc] init];

UITabBar *tabBar = [controller tabBar];
UIImage *backgroundImage = [UIImage imageNamed:@"Images/bottomBar.png"];
[tabBar setBackgroundImage:backgroundImage];

SplashScreenController *introController = [[SplashScreenController alloc] init];
UIImage *introImage = [UIImage imageNamed:@"Images/navIntro.png"];
UITabBarItem *introItem = [[UITabBarItem alloc] initWithTitle:@"Intro" image:introImage tag:0];
[introController setTabBarItem:introItem];

NSMutableArray *controllers = [[NSMutableArray alloc] init];
[controllers addObject:introController];

NSArray *controllers = [self createControllers];
[tabController setViewControllers:controllers];

nav bar

Upvotes: 0

Views: 265

Answers (1)

Mark Thibault
Mark Thibault

Reputation: 23

It looks like you are missing the retina version of your files, such as a 60x60 [email protected]. The [email protected] file needs to be in your project, but in code you would still reference the file as navIntro.png.

Upvotes: 1

Related Questions