开发者

Is there a way to share (hi-res) graphics in a Universal app?

I have an iPhone 4 app with both standard and hi-res graphics, e.g.:

icon-gun.png
icon-gun@2x.png

Now I want to do a iPad version, the size of icon-gun@2x.png will be good for the iPad version of my app. However, In开发者_如何转开发terface Builder does not show icon-gun@2x.png as a selectable item in the Image View list box.

Is there a way I can re-use the @2x PNGs without copying and renaming? Thanks!


You would have to set the image programmatically, I don't think there's a way to do it from the Interface Builder. Here is how to get a UIImage of your icon-gun@2x.png:

    NSString *imagePath = [[NSBundle mainBundle] 
            pathForResource: @"icon-gun@2x" ofType:@"png"];     
    UIImage *imgGun2x = [UIImage imageWithContentsOfFile:imagePath];    
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜