简体   繁体   中英

Is it sufficient to supply 3x image only for all versions on iPhone?

is it not enough to supply just 3x resolution image (eg for a view or button) in Xcode so that it looks good on iPhone 5,6,and 6plus devices ( ie leaving 1x and 2x in an image set blank )

My reasoning is that 1x image may look blurry on 6 plus but 3x image should look fine on 5

Basically i am asking so that i can communicate the same to my graphic designer and he should be fine with supplying a singe size rather than three sizes for all images

This got asked and answered many times regarding 2x assets, and the answer hasn't really changed (but it's hard to track down duplicate questions when I'm posting from my phone).

If you ship assets with a higher scale factor than the target device, they will display just fine. But downscaling them in real time has performance costs—they use more memory, they take longer to upload to the GPU, they take GPU time to render. Some of these costs are trivial, others aren't. (Remember, a 2x image is 4x the data of a 1x one, and a 3x image is 2.25x the data of a 2x one.) And they add up for every image in your app.

Most importantly, the devices with lower scale factors are the ones with less CPU/GPU/memory resources to spend on downscaling.

So, what to do? Well, if you don't want to have your artist deal with multiple scale factors, just order the 3x artwork and scale it yourself in Photoshop (or heck, even Preview) before you ship. It might not look as nice as if your artist tweaked it for each size, but it'll look about as good as real-time scaling without the run-time performance costs.

Or, with Xcode 6, you can put a PDF in your asset catalog, and Xcode will automatically generate PNGs for each size at build time. (This is an Xcode feature, not an iOS one, so it works even if you're targeting iOS 7.)

The problem with this idea is that in iOS 8 the iphone 4S is still supported and it has a different aspect ratio than every other iPhone. It renders at 320x480 at 2x so creating images to fit this wouldn't look grainy. The other 3 screen sizes would work if you go with the 3x scale which would be 1920x1080 for every page and just downscale the size for the 4in and 4.7in screens. You will likely need 2 story boards for the app (one for 3.5in and then the other for the 3 other screen sizes). Auto-sizing wouldn't really work in this case unless you changed the image of the UIImage because it would have a shortened length while maintaining the same width.

EDIT: changed the iPhone 6+ screen size to account for the 1.15x down scaling and changed the rendering factor to match the comment below

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM