[英]UIImage works on simulator but crashes on device swift
I have checked UIImage works on the simulator but not working on the device. 我已经检查过UIImage在模拟器上工作但没有在设备上工作。 Here's the code:
这是代码:
imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let image = UIImage(named: "sample.png")
imageView.image = image
view.addsubview(imageView)
How can I solve this problem? 我怎么解决这个问题?
Extremely larger images bigger than UIImageView size causes the crash. 比UIImageView大小更大的图像会导致崩溃。 UIImageView size is 50 x 50, but the image size is 900 x 900. This works on simulator but doesn't work on iOS device.
UIImageView尺寸为50 x 50,但图像尺寸为900 x 900.这适用于模拟器,但不适用于iOS设备。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.