Graphics Programs Reference
In-Depth Information
NSBundle *applicationBundle = [NSBundle mainBundle];
// Ask for the path to a resource named myImage.png in the bundle
NSString *path = [applicationBundle pathForResource:@"myImage"
ofType:@"png"];
If you ask for the path to a file that is not in the application's bundle, this method will re-
turn nil . If the file does exist, then the full path is returned, and you can use this path to
load the file with the appropriate class.
Also, files within the application bundle are read-only. You cannot modify them nor can
you dynamically add files to the application bundle at runtime. Files in the application
bundle are typically things like button images, interface sound effects, or the initial state
of a database you ship with your application. You will use this method in later chapters to
load these types of resources at runtime.
Search WWH ::




Custom Search