NSBundle — Mac OS X 10.0


This class represents directories in the filesystem that contain executable binaries, and any resources needed by the executable, such as images, sounds, or nibs. For more information about NSBundle, see Chapter 2.

image with no caption

@interface NSBundle : NSObject
                                  // Convenience Constructors
   + (NSBundle *)bundleForClass:(Class)aClass;
   + (NSBundle *)bundleWithIdentifier:(NSString *)identifier;
   + (NSBundle *)bundleWithPath:(NSString *)path;
                                  // Initializers
   - (id)initWithPath:(NSString *)path;
                                  // Class Methods
   + (NSArray *)allBundles;
   + (NSArray *)allFrameworks;
   + (BOOL)loadNibFile:(NSString *)fileName 
                                 externalNameTable:(NSDictionary *)context 
                                 withZone:(NSZone *)zone;
   + (BOOL)loadNibNamed:(NSString *)nibName 
   + (NSBundle *)mainBundle;
   + (NSString *)pathForResource:(NSString *)name 
                                 ofType:(NSString *)ext 
                                 inDirectory:(NSString *)path;
   + (NSArray *)pathsForResourcesOfType:(NSString *)ext 
                                 inDirectory:(NSString *)subpath;
   + (NSArray *)preferredLocalizationsFromArray:(NSArray *)localizationsArray;
   + (NSArray *)preferredLocalizationsFromArray:(NSArray *)localizationsArray           
                                 forPreferences:(NSArray *)preferencesArray;
                                  // Instance Methods
   - (NSString *)builtInPlugInsPath;
   - (NSString *)bundleIdentifier;
   - (NSString *)bundlePath;
   - (Class)classNamed:(NSString *)className;
   - (NSAttributedString *)contextHelpForKey ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.