简体   繁体   English

灰色方形而不是在标签栏的图像。 我用故事板

[英]Gray square instead of an image in the tab bar. I use storyboard

I uploaded a picture in the project, have it in the inspector, but only bar button draws a gray square. 我在项目中上传了图片,在检查器中保存了图片,但是只有条形按钮绘制了一个灰色正方形。 In other examples, nothing further is required. 在其他示例中,不需要任何其他操作。 What to do? 该怎么办? 在此处输入图片说明

UITabBarItems' image property automatically sets the render mode of images to template. UITabBarItems的image属性自动将图像的渲染模式设置为模板。 If you want to use a full color image as a tabbar item image you should explicitly set the render mode of the image to UIImageRenderingModeAlwaysOriginal . 如果要将全色图像用作选项卡项目图像,则应将图像的渲染模式显式设置为UIImageRenderingModeAlwaysOriginal You can set this in a .xcassets folder by selecting the image, opening the right pane, and setting render as "Original Image". 您可以在.xcassets文件夹中进行设置,方法是选择图像,打开右窗格,然后将渲染设置为“原始图像”。 Right now the tabbar is only looking at the alpha value of the image and tinting it gray. 现在,标签栏仅查看图像的Alpha值并将其着色为灰色。 For more information you should look at the UIKit User Interface Catalog 有关更多信息,请查看UIKit用户界面目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM