iOS的背景和图像看起来视网膜显示屏无法正常比例 [英] iOS background and images seem to not scale properly for retina display

查看:307
本文介绍了iOS的背景和图像看起来视网膜显示屏无法正常比例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用下列code:

self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"texture1.png"]];

我的观点的纹理背景被设置就好了。但我可以看到的图像没有为视网膜显示适当的比例,他们似乎更多的像素化,而不是丰富的质感和色彩,因为他们应该的。我曾与其他图像过这个问题,当试图使图像iPhone 5的屏幕淡出的大小了,只是它的一部分会被看到,而其余的将被切断,即使分辨率是罚款。任何想法,我在这里丢失?

The texture background of my view gets set just fine. But I can see that the images are not scaled properly for a retina display, they seem more pixelated, rather than rich in texture and color as they should be. I have had this issue with other images too, when trying to make an image the size of the iphone 5 screen fade away, only a part of it would be seen, and the rest would be cut off, even though the resolution is fine. Any idea what I am missing here?

编辑:是否有与图像的默认DPI,我现在用做

Does it have to do with the default dpi of the images that I am using?

编辑#2:下面是截图:

EDIT #2: Here is a screenshot:

在一个侧面说明,没有人知道是否除了 http://subtlepatterns.com/ 良好的背景纹理来源是什么?

On a side note, does anyone know if good background texture sources besides http://subtlepatterns.com/?

编辑#3:这是我尝试使用IOS亚麻模式一个很好的例子

EDIT #3: Here is a good example of me attempting to use the ios-linen pattern

推荐答案

首先取下,如果你是使用@ 2倍的图像从图像名称的.png

firstly remove .png from image name if you are use @2x image

self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"texture1"]];

请检查图像的高度和宽度显示保留..

Please check the image height and width for retain display ..

<一个href=\"http://developer.apple.com/library/ios/#documentation/2DDrawing/Conceptual/DrawingPrintingiOS/SupportingHiResScreensInViews/SupportingHiResScreensInViews.html#//apple_ref/doc/uid/TP40010156-CH15-SW1\"相对=nofollow>苹果 在具有高分辨率屏幕,imageNamed:,imageWithContentsOfFile:和initWithContentsOfFile设备:方法会自动查找与@ 2X版本所要求的图像修改其名称。如果找到一个,它加载的图片来代替。如果你不提供一个给定的图像的高分辨率版本,图像对象仍然加载一个标准分辨率的图像(如果存在)和绘图过程中刻度。

这篇关于iOS的背景和图像看起来视网膜显示屏无法正常比例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆