有时在 iOS Swift 上渲染粉红色容器的图像资产

问题描述

我在 iOS 手机设备 (Swift) 上看到我的图像资产出现奇怪的错误

Error Image

What it's supposed to be

所以.. 有时,图像资产被粉红色容器覆盖。在上周之前我没有出现任何这些错误,但不知何故我现在看到了。

图像文件是 png 文件,我将其设置为“认渲染”或“渲染为原始图像”。该错误不会在 XCode 模拟器上发生。

但是,当我将其上传到任何 iOS 设备时就会发生这种情况。

class EditButton: UIButton {
init() {
    super.init(frame: .zero)
    setimage(UIImage(named: "editPencil"),for: .normal)
    contentMode = .center
    imageView?.contentMode = .scaleAspectFit
    imageView?.isUserInteractionEnabled = true
    clipsToBounds = true
    translatesAutoresizingMaskIntoConstraints = false
    widthAnchor.constraint(equalToConstant: 10).isActive = true
}

required init?(coder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}

}

有趣的是我在其他 png 文件中没有这些错误..

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)