我有这个代码在tabbar中显示彩色图像。
_itemOneNavigationController.tabBarItem.image = [[UIImage imageNamed:@"tabbar-trophy"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
_itemOneNavigationControllerr.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar-trophy-selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
这适用于iPhone5&但是,在iPhone6& 6+,图像出现但不占用整个tabBarItem。他们出现在中心位置。
答案 0 :(得分:0)
尝试UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:
UIImage *unselected = [[UIImage imageNamed:@"tabbar-trophy"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *selected = [[UIImage imageNamed:@"tabbar-trophy-selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[_itemOneNavigationController.tabBarItem setFinishedSelectedImage:selected withFinishedUnselectedImage:unselected];