UITabBarItems不以自定义大小的UITabBar为中心

时间:2011-12-22 16:54:37

标签: iphone objective-c ios

我的UITabBarItems没有在我的UITabBar中垂直居中显示。我正在为我的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

1 个答案:

答案 0 :(得分:1)

您似乎错过了文件的视网膜版本,例如60x60 navIntro@2x.pngnavIntro@2x.png文件需要在您的项目中,但在代码中,您仍然会将文件引用为navIntro.png