标签栏项目是灰色方块

时间:2013-11-07 16:52:28

标签: ios iphone

正如你所看到的,代替图像只有一个大的灰色方块。我的资产目录中有一个图像,我通过属性检查器进行了设置。图像是50x50px,我在文档中读到它可以是任何大小但不大于96x96。截图如下。

enter image description here

谢谢!

1

1 个答案:

答案 0 :(得分:1)

iOS7中存在错误,未选中的标签栏项目始终采用灰色调颜色。

试试这个:(在AppDelegate应用程序中添加:didFinishLaunchingWithOptions:)

    UITabBarItem *item1 = self.tabBarController.tabBar.items[0];
    item1.image = [[UIImage imageNamed:@"tabbar-item1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; // unselected image
    item1.selectedImage = [UIImage imageNamed:@"tabbar-item1-selected"]; // selected image

    UITabBarItem *item2 ...
    ...