【问题标题】:Why does't the selectedImage of a tab bar show up properly?为什么标签栏的 selectedImage 不能正确显示?
【发布时间】:2015-06-22 19:11:52
【问题描述】:

我正在尝试为 UITabBar 选项卡的 selectedImage 指定图像。此图像包含在资产目录文件夹中。图片名为secondActive

但是,模拟器中显示的图像并不代表图像。它只是一个蓝色方块。当tintColor 改变时,方块的颜色也会改变。

我在 User Defined Runtime AttributesAttributes Inspector 中指定选项卡的 selectedImage

为什么标签栏的selectedImage 不能正常显示?

【问题讨论】:

    标签: ios storyboard uitabbar


    【解决方案1】:

    发生这种情况是因为您的图像不包含 Alpha 透明度。默认情况下,bar 和 tab bar 项在模板渲染模式下使用图像。您可以告诉系统以原始形式加载它,但是更改色调将不起作用(图像将具有图像本身给出的像素颜色)。最好重新创作您的图像,以便在需要时包含透明度。

    【讨论】:

    • 非常感谢! :-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多