我的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];
答案 0 :(得分:1)
您似乎错过了文件的视网膜版本,例如60x60 navIntro@2x.png
。 navIntro@2x.png
文件需要在您的项目中,但在代码中,您仍然会将文件引用为navIntro.png
。