iOS:为应用程序准备背景图像 [英] iOS: Preparing background images for applications

查看:140
本文介绍了iOS:为应用程序准备背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数iOS应用程序都有一个以图像为背景的视图。那里有图像尺寸指南吗?例如,这是在Sketch中设计的iOS屏幕:





尽可能看到有一个背景图片。现在每个应用程序都应该支持许多Apple设备。新的iOS 10支持从iPhone 5到iPhone 6s Plus的所有设备。它们具有不同的屏幕尺寸和分辨率。在创建Xcode资产时,我给出了3个不同大小的背景图像 - @ 1x,@ 2x,@ 3x 。它们的大小应该是多少?

解决方案

我看到它有两种选择:





    • 您不需要 @ 1图片因为你不支持iPhone 4和4s (iOS 10)

    • @ 2适用于iPhone 5,5c, 5S,6和6s所以基本上你可以创建最高分辨率的@ 2图像,这是iPhone 6,这个图像适用于iPhone 5系列。

    • 或者,你可以创建每张iPhone的分辨率图像,并使用硬编码逻辑设置图像用于每个手机。
      即:如果iphone5c {setImage(iphone5cImage)} 等等。







    1. 最简单的解决方案是创建一张分辨率最高的图像。 @ 3是iPhone 6S +中最高的,其余部分看起来都很棒。不要忘记将图像视图设置为纵横填充。

    另外,不要忘记检查这个主题:如何处理图像比例所有可用的iPhone分辨率?。它将为您提供您正在处理的具体线索。 TL; DR,这是我写的选项。


    Mostly every iOS application has a view with an image as background. Is there any image sizing guide out there? For example here is an iOS screen designed in Sketch:

    As you can see there is a background image. Now there are lots of Apple devices every application should support. The new iOS 10 supports all devices from iPhone 5 to iPhone 6s Plus. They have different screen sizes and resolutions. When creating Xcode assets, I am giving 3 background images with different sizes - @1x, @2x, @3x. What sizes should they be?

    解决方案

    The way I see it you have 2 options:

    1. In here you will find the resolutions of the iPhone's:

    • You don't need the @1 image since you don't support iPhone 4 and 4s (iOS 10).
    • @2 is for iPhone 5,5c,5S,6 and 6s so basically you can create @2 image of the highest resolution which is the iPhone 6 and this image will work well for the iPhone 5 family.
    • Or, you can create an image with resolution for each iPhone and using hard coded logic set the image for each phone. i.e: if iphone5c { setImage("iphone5cImage") } etc etc..

    1. The simplest solution is to create 1 image with the highest resolution. The @3 is the highest for the iPhone 6S+ and it will look amazing for the rest. Don't forget to set the image view as aspect fill.

    Also, don't forget to check this thread: How to handle image scale on all the available iPhone resolutions?. It will give you clues of what exactly you are dealing with. TL;DR, It's the options I wrote.

    这篇关于iOS:为应用程序准备背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆