[英]What is maximum resolution of an image that can be loaded in UIImageView in iOS Devices?
在iOS设备中可以使用SetImage:
方法在UIImageView
设置的UIImage
的最大分辨率是多少?
You can load any size of image in a UIImageView
as long a there is memory free. 您可以在UIImageView
加载任何大小的图像,只要没有可用的内存即可。 But it is not the UIImageView
that is taking up the memory, but the UIImage
. 但是占用内存的不是UIImageView
,而是UIImage
。
As Apple states the following in the UIImage
documentation you should not load to big an image: 如Apple在UIImage
文档中所述,您不应加载大图像:
You should avoid creating UIImage objects that are greater than 1024 x 1024 in size. 您应该避免创建大小大于1024 x 1024的UIImage对象。 Besides the large amount of memory such an image would consume, you may run into problems when using the image as a texture in OpenGL ES or when drawing the image to a view or layer. 除了此类图像会消耗大量内存外,在OpenGL ES中将图像用作纹理或将图像绘制到视图或图层时,您可能还会遇到问题。 This size restriction does not apply if you are performing code-based manipulations, such as resizing an image larger than 1024 x 1024 pixels by drawing it to a bitmap-backed graphics context. 如果执行基于代码的操作(例如,通过将图像绘制到位图支持的图形上下文来调整大于1024 x 1024像素的图像的大小),则此大小限制不适用。 In fact, you may need to resize an image in this manner (or break it into several smaller images) in order to draw it to one of your views. 实际上,您可能需要以这种方式调整图像大小(或将其分解为几个较小的图像),以便将其绘制到您的视图中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.