ios - 带图像的 UIView

标签 ios uiview

<分区>


关闭 8 年前

在我的应用程序中,我有 UIViews,图像作为它们的 backgroundColorOpaque 设置为 1.0,backgroundColor 设置为白色。但在模拟器中,它们仍然以颜色混合图层模式显示为红色标志:

enter image description here

有没有办法让它们变绿?

UIView 也有同样的问题,它的背景来自带有 1.0 Alpha channel 的 UIColor。

最佳答案

设置 UIImageView 的背景颜色对此没有任何影响。

您所做的只是说“将透明图像颜色与背景颜色合并”,而不是“将透明颜色与 ImageView 下方的颜色合并”。

它仍然必须为透明度执行相同的渲染过程。

最好的方法是采用 UIImageView 广告下方的任何颜色作为 png 图像的背景,而不是使用透明的 png。

这是阻止这种情况的唯一方法。

关于ios - 带图像的 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24500301/

上一篇:ios - CCActionRemove/addChild 未在预定方法中一致显示

下一篇:ios - 自动滚动 UIscrollview

相关文章:

swift - UIView 作为 subview 不会剪辑到 super View

iphone - 无法检测 iPhone 上的纵向方向

ios - CGRect根据中心点定位

iphone - 如何为整个应用程序设置自定义字体?

ios - Xcode 4.2 要求核心数据属性的首字母小写

ios - 从 CLPlacemark 项中提取 dependentLocality

ios - swift 3 : Initializing UITableViewController

ios - 将时区感知 .isoformat() 日期时间字符串转换为 NSDate

ios - Xcode 6.0.1 Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc 失败,退出代码为 1

ios - 重新定位 UIView 保持其 subview 位置不变