About Asset Catalogs

Use asset catalogs to simplify management of images that are used by your app as part of its user interface.

使用asset catalogs可以简化应用程序中需要使用图片的管理,把它们作为用户界面的一部分。

An asset catalog can include:

一个asset catalog可以包括以下内容:

  • Image sets: Used for most types of images, an image set contains all the versions, or representations, of an image that are necessary to support various devices and scale factors.

    图像集:用于存储大多数类型的图片,一个图片集包含了所有的图片版本,可以满足多种不同的设备和缩放因子。

  • App icons: App icon sets contain all the representations of the icon that iOS apps must provide to be displayed on a device’s Home screen and in the App Store.

    应用图标:应用图标集包含了iOS应用程序所要求的所有尺寸图标,它们用于设备的屏幕以及苹果商店。

  • Launch images: Launch image sets contain all the representations of the static launch image that iOS apps must provide to be temporarily displayed when the app is launched.

    启动图片:启动图片集包含了iOS应用程序要求的所有尺寸的静态启动图片。它们用于在启动应用程序时的过渡。

  • OS X icons: OS X icon sets contain all the representations of an icon that OS X apps must provide.

    OS X图标: OS X图标集包含了OS X应用程序要求的所有尺寸图标。

View and customize the contents of asset catalogs using three main areas:

查看和自定义asset catalogs的内容使用以下三个主要区域:

  • Set list: See a list of all image sets, app icon sets, and image launch sets in the selected asset catalog.

    集合列表:查看在asset catalog中的所有列表,包括所有图片集, 应用图标集以及启动图片集。

  • Set viewer: View the individual image representations for the selected set.

    查看设置区:查看所选集合的所有图片尺寸。

  • Set Attributes inspector: Depending on what’s selected in the Set viewer, you can view and edit image attributes. Editable attributes include a set’s name, image types, template setting, and supported devices, size classes, and iOS versions. You can view the properties of an image including name, size, color space, as well as others.

    设置属性检查器:根据查看设置区的选择,你可以查看和编辑图片属性。 可编辑的属性包括一个集合的名称,图片类型,模板设置以及所支持的设备,各种尺寸类(size classes)和iOS版本等。 你还可以查看选中图片的所有属性信息,包括图片名,尺寸,色彩空间(color space)等等。

Each set in an asset catalog has a name. You can use that name to programmatically load any individual image contained in the set. To load an image, call the platform specific class method, passing in the name of the set that contains the image. The OS will load the image from the set that is most appropriate for the current scale factor. The platform method for iOS is imageNamed:. For OS X the platform method is imageNamed:

asset catalog中的每个集合都有一个名字。你可以使用那个名字通过编程加载任何一张集合中的图片。 要想加载一张图片,需要调用平台指定的类方法,把集合的名字作为参数传进去。 OS(操作系统) 会从集合加载最适合当前缩放因子的图片。 iOS 的平台方法是imageNamed: 。 OS X 的平台方法是imageNamed:

Xcode 6 provides different functionality for asset catalogs depending on the deployment target for your project:

Xcode 6 根据项目不同的部署目标(deployment target)为 asset catalogs 提供了不同的功能:

  • For all projects, individual images can be loaded using set names.

    所有项目,可以用集合名字加载里面的任何图片。

  • For projects with a deployment target of at least iOS 7 or OS X 10.9, Xcode compiles your asset catalogs into a runtime binary file format that reduces the download time for your app.

    对于iOS 7 或 OS X 10.9以上(包括)的项目,Xcode会将asset catalogs编译进一个运行二进制格式,这样可以减少应用程序的下载时间。

Each asset catalog in Xcode has a corresponding folder in the Finder, with an .xcassets extension, and subfolders for each set. Each set folder in turn contains its image representations, along with a Contents.json file, describing each image. That file is automatically created by Xcode.

每个asset catalog在Xcode中都能在Finder中找到相应的文件夹,文件扩展名为.xcassets, 里面有每个集合的文件夹。 每个文件夹里都包含了所有尺寸的图片以及一个Contents.json文件, 它用于描述所有图片。 该json文件是由Xcode自动创建的。

You can share asset catalogs across multiple projects in the same workspace.

你可以在同一个工作区的多个项目之间共享asset catalogs.

Related Articles

相关文章:

 

iOS-----About Asset Catalog的更多相关文章

  1. iOS: 解决Asset Catalog Compile Error - TDDIstiller instance can only be distilled only one time的错误

    执行命令:rm -rf /Users/<用户名>/Library/Developer/Xcode/DerivedData 然后重新编译项目即可.

  2. Asset Catalog Help (五)---Migrating an iOS App Icon Set or Launch Image Set

    Migrating an iOS App Icon Set or Launch Image Set Simplify image management by moving existing app i ...

  3. Asset Catalog Help (四)---Adding an iOS App Icon Set or Launch Image Set

    Adding an iOS App Icon Set or Launch Image Set Organize different resolutions of your app icons and ...

  4. Applications using Launch Screen Files and targetting iOS 7.1 and earlier need to also include a Launch Image in an Asset Catalog.

    在使用xcode6建的项目时,有时在ios7模拟器下会出现一下情况 导航栏上方和tabbar下方会有黑边 并且会有一下警告: Applications using Launch Screen File ...

  5. Asset Catalog Help (二)---Creating an Asset Catalog

    Creating an Asset Catalog Create an asset catalog to simplify management of your app’s images. 创建一个a ...

  6. 【译】4个你需要知道的Asset Catalog的秘密

    本文由CocoaChina译者 @唧唧歪歪 翻译,作者:Hector Matos 原文:4 XCODE ASSET CATALOG SECRETS YOU NEED TO KNOW 恶梦 想象你正在干 ...

  7. Asset Catalog Help (十)---Specifying a Resizable Area of an Image

    Specifying a Resizable Area of an Image Use the Xcode Slicing feature to specify the dimensions of a ...

  8. Asset Catalog Help (一)---About Asset Catalogs

    About Asset Catalogs Use asset catalogs to simplify management of images that are used by your app a ...

  9. Asset Catalog Creator Free 生成程序内图标的软件

    Asset Catalog Creator Free  生成程序内图标的软件

随机推荐

  1. 安卓稳定性压测工具_monkey环境搭建(简易)

    1.准备工具: sdk(64位操作系统):http://pan.baidu.com/s/1kV33pll sdk(32位操作系统):http://pan.baidu.com/s/1gfnww87 2. ...

  2. css中怎么设置透明度的问题

    小伙伴们是不是在找怎么样去设置页面的透明度的方法呢...别找了,我这儿就有,而且肯定够用了. 我自己会用到的就有两种,可以和大家分享一下. 1.用opcity的方法去设置透明度.代码如下: .div ...

  3. 部署额外域控制器,Active Directory

      部署额外域控制器 转自:http://yuelei.blog.51cto.com/202879/117599 如果域中只有一台域控制器,一旦出现物理故障,我们即使可以从备份还原AD,也要付出停机等 ...

  4. 个人博客作业week2——代码复审

    1.代码规范 这些规范都是官僚制度下产生的浪费大家的编程时间.影响人们开发效率, 浪费时间的东西. 代码规范并不是从官僚制度下产生,它是为了提高项目团队开发效率而产生的一种工具,能够极大的增强代码可读 ...

  5. 使用github与jekyll搭建个人博客(一)

    虽然使用博客园还没有多久,但是最近看到一些大神的博客觉得很是炫酷.于是突发奇想,想要搭建自己的博客站点儿.编程菜鸟一枚,还是想要记录下最近的搭建博客经历. 使用github搭建个人博客的方式有很多,百 ...

  6. Struts2中获取servlet API的几种方式

    struts2是一个全新的MVC框架,如今被广大的企业和开发者所使用,它的功能非常强大.这给我们在使用servlet 纯java代码写项目的时候带来了福音.但是一般来说,我们的项目不到一定规模并不需要 ...

  7. Eclipse不能自动编译 java文件

      在网上的解决方法 方法参考如下: (1) Window-->Preferences-->General-->Workspace  有个"Build automatica ...

  8. Python list嵌套 三维数组

    cores_multicast = [[] for i in xrange(64)] temp_list = [0, 1] temp_list2 = [0, 3] cores_multicast[0] ...

  9. 最快让你上手ReactiveCocoa之进阶篇

    前言 由于时间的问题,暂且只更新这么多了,后续还会持续更新本文<最快让你上手ReactiveCocoa之进阶篇>,目前只是简短的介绍了些RAC核心的一些方法,后续还需要加上MVVM+Rea ...

  10. .NET JSON对象序列化和反序列化

    class Program { static void Main(string[] args) { Console.WriteLine("========================== ...