使用iPhone 4 Retina Display的colorWithPatternImage(image@2x.png) [英] colorWithPatternImage with iPhone 4 Retina Display (image@2x.png)

查看:1157
本文介绍了使用iPhone 4 Retina Display的colorWithPatternImage(image@2x.png)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢每当我输入@ 2x时SO的搜索功能爆炸,很难说这是否已被问过......

Thanks to SO's search function blowing up whenever I enter "@2x", it's difficult to tell whether this has already been asked...

我去过使用colorWithPatternImage:为我的各种视图构建平铺的背景图像。然而,当在新的iPhone 4显示器上观看时,这些可以预测看起来像垃圾。所以我已经构建了我的tile.png文件的@ 2x版本,但是colorWithPatternImage:显然无法正确处理UIImages的两倍规模。

I've been using colorWithPatternImage: to build tiled background images for my various views. However, these predictably look like trash when viewed on the new iPhone 4 display. So I've built @2x versions of my tile.png files, yet colorWithPatternImage: evidently can't properly handle UIImages with double the scale.

是否有人有效开发了解决此问题的方法?也许在CoreGraphics框架内(其中,我是新手)?

Has anyone effectively developed a workaround for this issue? Perhaps within the CoreGraphics framework (of which, I'm quite the novice)?

推荐答案

我相信这是一个错误SDK。 colorWithPatternImage:使用高清图像做了一些奇怪的事情。它上面有一个小的关于Apple Dev论坛的主题,但基本上我认为这是一个错误。不确定Apple是否还清楚它。

I believe this is a bug with the SDK. colorWithPatternImage: is doing strange things with the HD image. There's a small thread on the Apple Dev Forums on it, but basically I think it's a bug. Not sure if Apple are aware of it just yet.

我通过在中的视图的子类中绘制模式来解决这个问题 - drawRect:

希望这会有所帮助。

- (void)drawRect:(CGRect)rect {
    [[UIImage themeImageNamed:@"UIBackgroundPattern.png"] drawAsPatternInRect:rect];
}

这篇关于使用iPhone 4 Retina Display的colorWithPatternImage(image@2x.png)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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