【发布时间】:2014-04-28 06:41:17
【问题描述】:
我有一个带有 4 个标签的 UITabBar。 3/4 选项卡有标题和图像。我想在第一个选项卡中只显示一张图片。它在模拟器上运行良好,但在 iPhone 上它看起来像屏幕截图。它在底部种植。图标大小:第 2,3 和第 4 个图标(视网膜大小)为 46x42,第 1 个图标为 92x80,视网膜大小。
截图
代码
_tabBarController = [[UITabBarController alloc]init];
_tabBarController.delegate=self;
_firstNavigationController = [[TypeCollectionViewController alloc] initWithNibName:@"TypeCollectionViewController" bundle:nil];
_firstNavigationController.title = @"first";
firstNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
NSArray *controllers = [NSArray arrayWithObjects: firstNavigationController, secondNavigationController, thirdNavigationController, fNavigationController, nil];
_tabBarController.viewControllers = controllers;
[[[_tabBarController.tabBar items] objectAtIndex:0] setImage:[UIImage imageNamed:@"first-icon.png"]];
[[[_tabBarController.tabBar items] objectAtIndex:1] setImage:[UIImage imageNamed:@"second-icon.png"]];
[[[_tabBarController.tabBar items] objectAtIndex:2] setImage:[UIImage imageNamed:@"third-icon.png"]];
[[[_tabBarController.tabBar items] objectAtIndex:3] setImage:[UIImage imageNamed:@"f-icon.png"]];
[_tabBarController setSelectedIndex:0];
[self.window setRootViewController:_tabBarController];
[[[_tabBarController.tabBar items] objectAtIndex:0] setTitle:nil];
[self.window makeKeyAndVisible];
如何解决这个问题?提前致谢。
【问题讨论】:
-
请尝试一次您的图像高度为正常 48 和 @2x 96
-
@MitsBhadeshiya 没有任何改变。应该怎么办?
标签: ios objective-c uitabbar uitabbaritem