Organization of This Document
See Also
Applied to computer programs, resources are data files that accompany a program’s executable code. You can use resources to simplify the job of programming and also to reduce the amount of time it takes to develop your applications. Instead of programmatically creating images or the controls associated with your user interface, you can create resource files that contain the data for those items. When loaded at runtime, the resource-loading routines use the data in the resource file to create the objects or data structures your code requested.
Resources are also an intimate part of the internationalization process for Mac OS X applications. Rather than hard-coding strings and other user-visible content in your application, you should place that content in external resource files. Localizing your application then becomes a simple process of creating a new copy of those resource files for each supported language and dropping them inside the appropriate directories in your application bundle. The Mac OS X bundle organization makes sure that the resources your application requests match the language preferences of the current user.
This document provides information about the types of resources supported in Mac OS X applications 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. Although this document focuses on the use of resources in bundled applications, most of the information also applies to other types of Mac OS X packages, such as 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:
“Resources in Mac OS X” provides an introduction to resource types supported in Mac OS X.
“Nib Files and Cocoa” describes the Cocoa-specific support for nib files.
“Nib Files and Carbon” 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 describes the application used to create nib file resources.
Property List Programming Guide for Cocoa 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.
Last updated: 2007-09-04