Asset Catalog Help (八)---Customizing Image Sets for Devices

本文介绍如何在Xcode中创建和定制图片集,使其能在不同设备上显示最佳效果。详细步骤包括选择图片集、开启工具区、选择特定设备等。此外,还探讨了在不同设备上显示不同尺寸图片的需求场景,以及iOS8及以上版本应用中尺寸类的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Customizing Image Sets for Devices

Add images to a set that are customized for display on the devices supported by your app.

应用程序支持把图片加入一个自定义图片集,用来在不同设备商显示。 
  1. In the set list, select an image set.

    在图片集列表中,选择一个图片集。

  2. Open the utilities area for the workspace window by clicking the Show Utilities button (../Art/XC_O_utilities_button_2x.png).

    点击(../Art/XC_O_utilities_button_2x.png)显示工作区窗口的工具区(utilities area).

  3. In the inspector bar, click the Attributes Inspector button (../Art/XC_O_attributes_inspector_button_2x.png).

    在inspector 栏,点击属性检查按钮 (../Art/XC_O_attributes_inspector_button_2x.png)。

  4. From the Device pop-up menu, choose Device Specific.

    在Device弹出菜单那,选择Device Specific.

    ../Art/XC_AC_H_device-popup.shot/Resources/shot_2x.png
  5. Use the checkboxes in the Attributes inspector to select the devices.

    在属性检查器内选择需要设置的设备。

    ../Art/XC_AC_H_device-checkboxes.shot/Resources/shot_2x.png

    In the figure above, the image is customized for the iPhone and Apple Watch. The image still needs files for the retina 4-inch iPhone and both resolutions for the iPad.

    上图,Image图片集是为iPhone和Apple Watch定义的。 图片集还需要retina 4-inch尺寸的iPhone文件,以及iPad的两种分辨率文件。

You need to add device specific images to a set only when your app needs to display different sizes of the image on different devices. For example, a background image for your main view showing a watermark of your logo could need all of the different sizes shown in the figure above. But an icon for a button that does not vary between devices can use only the universal setting shown in the first figure because no special sizes are required.

只有当你的应用程序需要在不同的设备上显示不同尺寸的图片时才需要把设备指定的图片放入一个集合。 比如,一张用于主视图的背景图片,图片上需要打印不同尺寸的Logo水印时可以使用上图所示的指定特殊设备的图片集。如果只是一个用于按钮的图标,它在不同设备间不会变化的图标,则只需要使用图一种的universal设置,因为不需要特殊的尺寸。

Customizing your images for devices is one way that your app can support multiple screen sizes and orientations. For apps designed for iOS 8 and later, size classes provide a more flexible alternative.

为不同设备自定义不同图片是让你的应用程序支持多个屏幕尺寸和方向的一种方法。对于iOS8或以上版本的应用程序,尺寸类可以提供一种更加灵活的替代选择。

转载于:https://www.cnblogs.com/patientAndPersist/p/4428819.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值