如何在Xcode中指定全屏背景图片,这样不会在设备上安装多余的图片? [英] How do I specify fullscreen background images in Xcode so redundant images aren't installed to devices?

查看:437
本文介绍了如何在Xcode中指定全屏背景图片,这样不会在设备上安装多余的图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Xcode 6开发一个ObjC iPhone应用程序,最低版本为iOS 7.

I am developing an ObjC iPhone app in Xcode 6, targeting iOS 7 as the minimum version.

我的应用程序中有主要UIViewController实例的全屏背景图像.该应用程序使用四个视觉主题,每个背景现在都有三种尺寸.为了支持4英寸,4.7英寸和5.5英寸的屏幕,图像宽度分别为640、750和1242像素.在我的项目中,我根据[[UIScreen mainScreen] nativeBounds]的结果选择特定图像以获取与屏幕分辨率,例如background_gray(用于640像素),background_gray_750background_gray_1242.

I have fullscreen background images for the main UIViewController instance in my app. The app uses four visual themes, and each background now comes in three sizes. To support 4", 4.7", and 5.5" screens, the image widths are 640, 750, and 1242 pixels respectively. In my project, I choose a specific image based on the result of [[UIScreen mainScreen] nativeBounds] to get the background image corresponding to the screen resolution. For example, background_gray (for 640 pixels), background_gray_750, and background_gray_1242.

有没有一种方法可以将我的所有背景图像排列在Xcode xcassets包中,以便每个设备仅获得将要使用的背景图像?换句话说,像素宽度为750和1242像素的背景将永远不会在3.5英寸或4英寸的屏幕上使用.

Is there a way I can arrange all of my background images in an Xcode xcassets bundle so each device will only get the background images it will use? In other words, the backgrounds with pixel widths of 750 and 1242 pixels will never get used on a 3.5" or 4" screen.

640像素宽750像素宽的图像均为2倍,因此不必简单地使用相同的名称指定一个图像的1x,2x和3x版本.

Both the 640-pixel 750-pixel width images are 2x, so this isn't a matter of simply specifying 1x, 2x, and 3x versions of one image using the same name.

推荐答案

不,对于通过iPad的所有iPhone 4设备,只有一个应用程序捆绑包分发到了商店.该捆绑软件将需要保存所有设备的图像.

No, there is only a single application bundle distributed to the store for all devices iPhone 4 through iPad. This bundle will need to hold your images for all devices.

这篇关于如何在Xcode中指定全屏背景图片,这样不会在设备上安装多余的图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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