简体   繁体   English

仅为iPhone上的所有版本提供3x图像是否足够?

[英]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 ) 仅仅在Xcode中提供3倍分辨率的图像(例如视图或按钮)是不够的,这样它在iPhone 5,6和6plus设备上看起来不错(即在图像集空白处留下1x和2x)

My reasoning is that 1x image may look blurry on 6 plus but 3x image should look fine on 5 我的理由是1x图像在6加上可能看起来模糊但3x图像在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). 关于2x资产,这被多次询问和回答,答案并没有真正改变(但是当我从手机上发帖时,很难找到重复的问题)。

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. 但实时缩减它们会带来性能成本 - 它们使用更多内存,上传到GPU需要更长时间,它们需要GPU时间来渲染。 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. (请记住,2x图像是1x图像的4倍,3x图像是2x图像的2.25倍。)并且它们会为应用中的每个图像加起来。

Most importantly, the devices with lower scale factors are the ones with less CPU/GPU/memory resources to spend on downscaling. 最重要的是,具有较低比例因子的设备是具有较少的CPU / GPU /内存资源以用于降尺度的设备。

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. 好吧,如果你不想让你的艺术家处理多个比例因子,只需订购3x艺术品并在发货前自己在Photoshop(或者heck,甚至是Preview)中进行缩放。 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. 或者,使用Xcode 6,您可以在资产目录中放置PDF,Xcode将在构建时自动为每个大小生成PNG。 (This is an Xcode feature, not an iOS one, so it works even if you're targeting iOS 7.) (这是一个Xcode功能,而不是iOS功能,所以即使你的目标是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. 这个想法的问题是在iOS 8中仍然支持iphone 4S,它具有与其他所有iPhone不同的宽高比。 It renders at 320x480 at 2x so creating images to fit this wouldn't look grainy. 它以2x的速度渲染为320x480,因此创建适合此图像的图像看起来不会有颗粒感。 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. 如果您使用3x比例(每页为1920x1080),只需缩小4英寸和4.7英寸屏幕的尺寸,其他3种屏幕尺寸就可以使用。 You will likely need 2 story boards for the app (one for 3.5in and then the other for the 3 other screen sizes). 您可能需要2个故事板用于应用程序(一个用于3.5英寸,然后另一个用于其他3个屏幕尺寸)。 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. 除非您更改UIImage的图像,否则自动调整大小在这种情况下不会真正起作用,因为它会在保持相同宽度的同时缩短长度。

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 编辑:更改iPhone 6+屏幕大小以考虑1.15倍缩小比例并更改渲染因子以匹配下面的评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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