标签栏项目是一个灰色正方形 [英] Tab Bar Item is a grey square

查看:55
本文介绍了标签栏项目是一个灰色正方形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如您所见,没有图像,只有一个大的灰色方块.我的资产目录中有一个图像,并且已经通过属性检查器对其进行了设置.图片为50x50px,我在文档中读到它可以是任何大小,但不能大于96x96.下面的屏幕截图.

As you can see, instead of an image there is just a big grey square. I have an image in my asset-catalog and I've set it through the attributes inspector. The image is 50x50px, and I read in documentation that it could be of any size but not bigger than 96x96. Screenshot below.

谢谢!

1 :

推荐答案

iOS7中存在错误,未选中的选项卡栏项始终为灰色.

There is bug in iOS7 and the unselected tab bar item is always with grey tint color.

尝试以下操作:(添加到AppDelegate应用程序中:didFinishLaunchingWithOptions:)

Try this: (add in AppDelegate application: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 ...
    ...

这篇关于标签栏项目是一个灰色正方形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆