Inherits from | |
Framework | /System/Library/Frameworks/AppKit.framework |
Companion guide | |
Declared in | NSHelpManager.h NSImage.h NSNibLoading.h NSSound.h |
The Application Kit extends the behavior of the Foundation framework’s NSBundle class to support the loading of specific resource types.
The NSBundle
additions add support for the following tasks:
Loading nib files
Locating image and sound resources
Accessing context help from a Help.plist
file
These methods become part of the NSBundle
class only for those applications that use the Application Kit.
+ loadNibFile:externalNameTable:withZone:
+ loadNibNamed:owner:
– loadNibFile:externalNameTable:withZone:
Unarchives the contents of the nib file and links them to objects in your program.
+ (BOOL)loadNibFile:(NSString *)fileName externalNameTable:(NSDictionary *)context withZone:(NSZone *)zone
The location of the nib file specified as an absolute path in the file system.
A name table whose keys identify objects associated with your program or the nib file. The newly unarchived objects from the nib file use this table to connect to objects in your program. For example, the nib file uses the object associated with the NSNibOwner
constant as the nib file's owning object. If you associate an empty NSMutableArray
object with the NSNibTopLevelObjects
constant, on output, the array contains the top level objects from the nib file. For descriptions of these constants, see NSNib Class Reference.
The memory zone in which to allocate the nib file objects.
YES
if the nib file was loaded successfully; otherwise, NO
.
This method is declared in NSNibLoading.h
.
NSNibLoading.h
Unarchives the contents of the nib file and links them to a specific owner object.
+ (BOOL)loadNibNamed:(NSString *)aNibName owner:(id)owner
The name of the nib file, which need not include the .nib
extension. The file name should not include path information. The object in the owner parameter determines the location in which to look for the nib file.
The object to assign as the nib FIle's Owner. If the class of this object has an associated bundle, that bundle is searched for the specified nib file; otherwise, this method looks in the main bundle.
YES
if the nib file was loaded successfully; otherwise, NO
.
This method is declared in NSNibLoading.h
.
+ bundleForClass:
(NSBundle)NSNibLoading.h
Returns the context-sensitive help for the specified key from the bundle's help file.
- (NSAttributedString *)contextHelpForKey:(NSString *)key
A key in your application's Help.plist
file that identifies the context-sensitive help to return.
The help string or nil
if the application does not have a Help.plist
file or the file does not contain an entry for the specified key.
When you build your application, you can merge multiple RTF-based help files together using the /usr/bin/compileHelp
tool, which then packages your help file information into a property list named Help.plist
. After placing this property-list file in your application bundle, you can use this method to extract context help information from it. To look up a particular entry, you specify the name of the original RTF help file in the key parameter of this method. For example, if your application project contains a help file named Copy.rtf
, you would retrieve the text from this file by passing the value @"Copy.rtf"
to the key parameter.
This method is declared in NSHelpManager.h
.
– contextHelpForObject:
(NSHelpManager)NSHelpManager.h
Unarchives the contents of a nib file located in the receiver's bundle.
- (BOOL)loadNibFile:(NSString *)fileName externalNameTable:(NSDictionary *)context withZone:(NSZone *)zone
The name of the nib file, which need not include the .nib
extension.
A name table whose keys identify objects associated with your program or the nib file. The newly unarchived objects from the nib file use this table to connect to objects in your program. For example, the nib file uses the object associated with the NSNibOwner
constant as the nib file's owning object. If you associate an empty NSMutableArray
object with the NSNibTopLevelObjects
constant, on output, the array contains the top level objects from the nib file. For descriptions of these constants, see NSNib Class Reference.
The memory zone in which to allocate the nib file objects.
YES
if the nib file was loaded successfully; otherwise, NO
.
This method searches the language-specific project (.lproj
) directories for the specified nib file. If the file is not there, it searches the bundle's Resources
directory for a nonlocalized version of the file.
This method is declared in NSNibLoading.h
.
NSNibLoading.h
Returns the location of the specified image resource file.
- (NSString *)pathForImageResource:(NSString *)name
The name of the image resource file, without any pathname information. Including a filename extension is optional.
The absolute pathname of the resource file or nil
if the file was not found.
Image resources are those files in the bundle that are recognized by the NSImage
class, including those that can be converted using the Image IO framework.
This method is declared in NSImage.h
.
– pathForResource:ofType:
(NSBundle)NSImage.h
Returns the location of the specified sound resource file.
- (NSString *)pathForSoundResource:(NSString *)name
The name of the sound resource file, without any pathname information. Including a filename extension is optional
The absolute pathname of the resource file or nil
if the file was not found.
Sound resources are those files in the bundle that are recognized by the NSSound
class. The types of sound files can be determined by calling the soundUnfilteredFileTypes
method of NSSound
.
This method is declared in NSSound.h
.
– pathForResource:ofType:
(NSBundle)NSSound.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-07-19)