PATH  Documentation > Mac OS X > Application Kit Reference: Objective-C

Table of Contents

NSBundle Additions


Inherits from:
NSObject
Declared in:
AppKit/NSHelpManager.h
AppKit/NSImage.h
AppKit/NSNibLoading.h
AppKit/NSSound.h




Class Description


The Application Kit adds methods to the Foundation Framework's NSBundle class for:

These methods become part of the NSBundle class only for those applications that use the Application Kit.

For information on bundles, see the NSBundle class specification in the Foundation Framework Reference.




Method Types


Loading nib files
+ loadNibFile:externalNameTable:withZone:
+ loadNibNamed:owner:
- loadNibFile:externalNameTable:withZone:
Locating NSImage resources
- pathForImageResource:
Accessing context help
- contextHelpForKey:
Locating NSSound resources
- pathForSoundResource:


Class Methods



loadNibFile:externalNameTable:withZone:

+ (BOOL)loadNibFile:(NSString *)fileName externalNameTable:(NSDictionary *)context withZone:(NSZone *)zone

Unarchives the contents of the nib file whose absolute path is fileName. Objects from the nib file are allocated in the memory zone specified by zone. The context argument is a name table-a dictionary whose keys are names like "NSOwner" and whose values are existing objects that can be referenced by the newly unarchived objects. Returns YES upon success, or NO if the specified nib file couldn't be loaded.

This method is declared in NSNibLoading.h.



loadNibNamed:owner:

+ (BOOL)loadNibNamed:(NSString *)aNibName owner:(id)owner

Similar to loadNibFile:externalNameTable:withZone:, but the name table's only element is the object specified by owner (stored with the key "NSOwner"). Objects from the nib file are allocated in owner's zone. If there's a bundle for owner's class, this method looks in that bundle for the nib file named aNibName (this argument need not include the ".nib" extension); otherwise, it looks in the main bundle.

This method is declared in NSNibLoading.h.

See Also: + bundleForClass: (NSBundle)




Instance Methods



contextHelpForKey:

- (NSAttributedString *)contextHelpForKey:(NSString *)key

Returns the context-sensitive help from the help file named key; or nil if Help.plist isn't present or if Help.plist doesn't contain an entry for key.

When you build your application, /usr/bin/compileHelp packages your help files into a property list named Help.plist. contextHelpForKey: extracts context help from this file, but looks it up using the name of the original help file. For example, if your application project contains a help file Copy.rtf, you can get its text using contextHelpForKey: with the argument @"Copy.rtf".

This method is declared in NSHelpManager.h.

See Also: - contextHelpForObject: (NSHelpManager)



loadNibFile:externalNameTable:withZone:

- (BOOL)loadNibFile:(NSString *)fileName externalNameTable:(NSDictionary *)context withZone:(NSZone *)zone

Unarchives the contents of the nib file named fileName. The method first looks for the nib file in the language-specific ".lproj" directory; if the nib file isn't there, it looks for a non-localized resource in the immediate bundle directory. Objects from the nib file are allocated in the memory zone specified by zone. The context argument is a name table-a dictionary whose keys are names like "NSOwner" and whose values are existing objects that can be referenced by the newly unarchived objects. Returns YES upon success, or NO if the specified nib file couldn't be loaded.

This method is declared in NSNibLoading.h.



pathForImageResource:

- (NSString *)pathForImageResource:(NSString *)name

Returns the absolute pathname of the file containing the specified image resource, or nil if the specified resource can't be located. Image resources are those files in the bundle that are recognized by NSImage without filtering (essentially, a file whose type is one of those returned by the imageUnfilteredFileTypes method). The resource name is simply the filename without the path of its bundle directory; the filename extension is optional.

This method is declared in NSImage.h.

See Also: - pathForResource:ofType: (NSBundle)



pathForSoundResource:

- (NSString *)pathForSoundResource:(NSString *)name;

Returns the absolute pathname of the file containing the specified sound resource, or nil if the specified resource can't be located. Sound resources are those files in the bundle that are recognized by NSSound without filtering (essentially, a file whose type is one of those returned by the soundUnfilteredFileTypes method). The resource name is simply the filename without the path of its bundle directory; the filename extension is optional.

This method is declared in NSSound.h.

See Also: - pathForResource:ofType: (NSBundle)




Table of Contents