简体   繁体   English

UIImageView呈现的图像与原始图像不同

[英]UIImageView renders image differently to original

The image on the right is the one that I produced in photoshop. 右边的图像是我在photoshop中制作的。 I then stripped all text and put it in an image view, as soon as I did that there was a change in colour and the vertical line lost it sharpness. 然后,我剥离所有文本并将其放在图像视图中,一经发现颜色发生变化,垂直线便失去了清晰度。 Has anyone else run into a similar problem? 还有其他人遇到类似的问题吗? What do I do? 我该怎么办? alt text http://grab.by/1DuZ 替代文字http://grab.by/1DuZ

Are the dimensions correct? 尺寸是否正确? Is the position of the image an integer? 图像的位置是整数吗? If these cases antialiasing will slightly blur your image. 如果出现这些情况,抗锯齿会稍微模糊您的图像。

One thing to be careful of is that if your image is an odd number of pixels in either dimension then centering it onscreen will cause it to be misaligned. 要注意的一件事是,如果您的图片在任一维度上都是奇数个像素,那么将其居中显示在屏幕上将导致其未对齐。 Imagine if you had a 1x1 image (just one pixel) and tried to center it perfectly onscreen. 想象一下,如果您有一个1x1的图像(只有一个像素),并试图将其完美地居中显示在屏幕上。 It can't be done because the screen is an even number of pixels wide and high. 由于屏幕的像素宽和高均为偶数,因此无法完成。 This is why it's best to always use even dimensioned images whenever possible. 这就是为什么最好总是尽可能使用尺寸均匀的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM