<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
在我的应用程序中,我有 UIViews
,图像作为它们的 backgroundColor
。
Opaque 设置为 1.0,backgroundColor
设置为白色。但在模拟器中,它们仍然以颜色混合图层模式显示为红色标志:
有没有办法让它们变绿?
UIView 也有同样的问题,它的背景来自带有 1.0 Alpha channel 的 UIColor。
最佳答案
设置 UIImageView
的背景颜色对此没有任何影响。
您所做的只是说“将透明图像颜色与背景颜色合并”,而不是“将透明颜色与 ImageView 下方的颜色合并”。
它仍然必须为透明度执行相同的渲染过程。
最好的方法是采用 UIImageView
广告下方的任何颜色作为 png 图像的背景,而不是使用透明的 png。
这是阻止这种情况的唯一方法。
关于ios - 带图像的 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24500301/