开发者

colorWithPatternImage with iPhone 4 Retina Display (image@2x.png)

Thanks to SO's search function blowing up whenever I ente开发者_运维知识库r "@2x", it's difficult to tell whether this has already been asked...

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.

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


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.

I've worked around it by drawing the pattern in a subclass of the view within -drawRect:.

Hope this helps.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜