If I have a bundle that contains a class and some resources used by that class. If I load the class from the bundle how should I load the resources(that are in the bundle where I loaded the class from) in that class?
Let's say I want to load an image inside my object instantiated from the class loaded from the bundle. If I do
NSImage *image = [NSImage imageNamed:@"myImage"];
Will it load the image that's inside the bundle from where I loaded the class from? or will it look in the bundle of the application that loaded the bundle with the class and resources?
This method searches for named images in several places, returning the first image it finds matching the given name. The order of the search is as follows:
- Search for an object whose name was set explicitly using the setName: method and currently resides in the image cache.
- Search the application's main bundle for a file whose name matches the specified string. (For information on how the bundle is searched, see ““Accessing a Bundle's Contents”“ in Bundle Programming Guide.)
- Search the Application Kit framework for a shared image with the specified name. When looking for files in the application bundle, it is better (but not required) to include the filename extension in the name parameter. (Link)