Organization of This Document
See Also
Applied to computer programs, resources are data files that accompany a program’s executable code. Resources simplify the code you have to write by moving the creation of complex sets of data or graphical content outside of your code and into more appropriate tools. For example, rather than creating images pixel by pixel using code, it is much more efficient (and practical) to create them in an image editor. To take advantage of a resource, all your code has to do is load it at runtime and use it.
In addition to simplifying your code, resources are also an intimate part of the internationalization process for all applications. Rather than hard-coding strings and other user-visible content in your application, you can place that content in external resource files. Localizing your application then becomes a simple process of creating new versions of each resource file for each supported language. The bundle mechanism used in both Mac OS X and iPhone OS provides a way to organize localized resources and to facilitate the loading of resource files that match the user’s preferred language.
This document provides information about the types of resources supported in Mac OS X and iPhone OS and how you use those resources in your code. This document does not focus on the resource-creation process. Most resources are created using either third-party applications or the developer tools provided in the /Developer/Applications
directory. In addition, although this document refers to the use of resources in applications, the information also applies to other types of bundled executables, including frameworks and plug-ins.
Before reading this document, you should be familiar with the organizational structure imposed by application bundles. Understanding this structure makes it easier to organize and find the resource files your application uses. For information on the structure of bundles, see Bundle Programming Guide.
This document includes the following chapters:
“About Resources” provides an introduction to the resource types supported in Mac OS X and iPhone OS.
“Nib Files” describes the Cocoa-specific support for nib files.
“Carbon Resources” describes the Carbon-specific support for nib files.
“String Resources” describes the support for localized string resources in applications.
“Image, Sound, and Video Resources” describes the support for image, sound, and video resources in applications.
The following ADC Reference Library documents are conceptually related to Resource Programming Guide:
Bundle Programming Guide describes the bundle structure used by applications to store executable code and resources.
Internationalization Programming Topics describes the process of preparing an application (and it’s resources) for translation into other languages.
Interface Builder User Guide describes the application used to create nib file resources.
Property List Programming Guide describes the facilities in place for loading property-list resource files into a Cocoa application.
Property List Programming Topics for Core Foundation describes the facilities in place for loading property-list resource files into a C-based application.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-01-06)