开发者

For UIImage, use of @2x w/o duplicating files

开发者 https://www.devze.com 2023-02-20 05:28 出处:网络
Beginner here.My app shows an UIImage (in a scroll view). If you are on retina device, then it should not scroll and I set the scroll view frame to be

Beginner here. My app shows an UIImage (in a scroll view).

If you are on retina device, then it should not scroll and I set the scroll view frame to be the exact size (640x960).

If you are not on a retina device then it should scroll, so I set the scroll view frame to the pixels (480x320).

I have this working by setting the frame sizes, as mentioned, in viewDidLoad()

So...my question is that I have to keep both images on disk. I have pix.png and pix@2x.png and they 开发者_如何学Goare exactly the same thing.

Any help on how to handle this? Maybe it is obvious, but not to me ;-)

thx!


In my opinion,If you load the image with the two file name, I think you should keep them on disk.If not, you can delete one of them. Nomatter what pixels size you set, the original pixels datas are always which image file you load from disk.


No, you shouldn't need two copies of the same image. The @2x scheme is just lets you automatically load a high resolution image when one is available. It sounds like you're already managing your scroll view's content size and things are working, so you can just get rid of the pix@2x.png file.

I'm not sure it's a great UI decision to change the app's behavior based on its screen resolution, though. Since you're already using a scroll view, it can be easy for the user to zoom in and out. Non-retina devices will display at native resolution when zoomed in; retina devices will display at native resolution when zoomed out.

0

精彩评论

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