我在iOS 5中有一个标签,并且希望为所选和未选择的状态设置TabBarButton
的图像。这是代码:
BOOL isIOS5 = [[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0;
if(isIOS5)
{
//[tabBarController.tabBar setBackgroundImage:[UIImage imageNamed:@"Tab-bg"]];
// [tabBarController.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"Cell-bg"]];
[[tabBarController.tabBar.items objectAtIndex:0] setFinishedSelectedImage:[UIImage imageNamed:@"list-menu-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"list-menu"]];
[[tabBarController.tabBar.items objectAtIndex:1] setFinishedSelectedImage:[UIImage imageNamed:@"gallery-menu-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"gallery-menu"]];
[[tabBarController.tabBar.items objectAtIndex:2] setFinishedSelectedImage:[UIImage imageNamed:@"map-menu-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"map-menu"]];
[[tabBarController.tabBar.items objectAtIndex:3] setFinishedSelectedImage:[UIImage imageNamed:@"submit-menu-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"submit-menu"]];
[[tabBarController.tabBar.items objectAtIndex:4] setFinishedSelectedImage:[UIImage imageNamed:@"search-menu-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"search-menu"]];
}
即。对于非视网膜显示,图像的高度为44px,因此它们应足以填充空间
问题是图像不能从上到下:在标签栏的底部还有一些未填充的空间。有没有人遇到过这个问题?
答案 0 :(得分:1)
这是49,你可以在这里看到: http://www.idev101.com/code/User_Interface/sizes.html
答案 1 :(得分:0)
如果您已经在检查iOS 5等特定情况,那么最简单的方法就是创建与条形码的精确像素高度相匹配的图像。或者,您可以查看tabBar.item本身可以设置的属性。