[英]UIImage gets distorted/wrong size in UIImageView
I have two UIImageView
with dimension 64 x 16 and two images (@2x): 我有两个尺寸为64 x 16的
UIImageView
和两个图像(@ 2x):
image1
(128 x 32) image1
(128 x 32) image2
(80 x 32). image2
(80 x 32)。 I've placed image1
in imageview1
and image2
in imageview2
. 我已将
image1
放在imageview1
,将image2
放在imageview2
。
When I run the app, imageview1
looks ok, but imageview2
looks distorted. 当我运行应用程序时,
imageview1
看起来没问题,但imageview2
看起来很扭曲。 How to deal with different image sizes? 如何处理不同的图像尺寸? I want the
UIImageView
size to be fixed (64 x 32). 我想要修复
UIImageView
大小(64 x 32)。
Any help would be really appreciated 任何帮助将非常感激
image1 with dimension 128 x 32 and image2 with dimension 80 x 32
image1的尺寸为128 x 32,image2的尺寸为80 x 32
Your 2x image should have 160 x 64 , not 128 x 32. 您的2x图像应为160 x 64 ,而不是128 x 32。
Edit: 编辑:
If you have a 64x16 points of UIImageView, that results in 128 x 32 pixels on a 2x scale screen, if you have an image with 80 x 32 pixels, that will get disorted if you try to put it inside a 64x16 point (128x32 pixels) UIImageView 如果你有一个64x16 点的UIImageView,那么在2倍规模的屏幕上会产生128 x 32 像素 ,如果你有一个80 x 32像素的图像,如果你试图把它放在一个64x16点(128x32像素)中会被中断)UIImageView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.