NSBundle UIKit Additions Reference
| Inherits from | |
| Framework | /System/Library/Frameworks/UIKit.framework |
| Availability | Available in iOS 2.0 and later. |
| Declared in | UINibLoading.h |
Overview
This category adds methods to the Foundation framework’s NSBundle class. The method in this category provides support for loading nib files into your application.
Instance Methods
loadNibNamed:owner:options:
Unarchives the contents of a nib file located in the receiver's bundle.
Parameters
- name
The name of the nib file, which need not include the
.nibextension.- owner
The object to assign as the nib’s File's Owner object.
- options
A dictionary containing the options to use when opening the nib file. For a list of available keys for this dictionary, see “Nib File Loading Options.”
Return Value
An array containing the top-level objects in the nib file. The array does not contain references to the File’s Owner or any proxy objects; it contains only those objects that were instantiated when the nib file was unarchived. You should retain either the returned array or the objects it contains manually to prevent the nib file objects from being released prematurely.
Discussion
You can use this method to load user interfaces and make the objects available to your code. During the loading process, this method unarchives each object, initializes it, sets its properties to their configured values, and reestablishes any connections to other objects. (To establish outlet connections, this method uses the setValue:forKey: method, which may cause the object in the outlet to be retained automatically.) For detailed information about the nib-loading process, see Resource Programming Guide.
If the nib file contains any proxy objects beyond just the File’s Owner proxy object, you can specify the runtime replacement objects for those proxies using the options dictionary. In that dictionary, add the UINibExternalObjects key and set its value to a dictionary containing the names of any proxy objects (the keys) and the real objects to use in their place. The proxy object’s name is the string you assign to it in the Identifier field of the Interface Builder inspector window.
Availability
- Available in iOS 2.0 and later.
Declared In
UINibLoading.hConstants
Nib File Loading Options
The options that can be specified during nib loading.
extern NSString * const UINibProxiedObjectsKey; extern NSString * const UINibExternalObjects
Constants
UINibProxiedObjectsKeyIn iOS 2.x, the value for this key is a dictionary that contains the runtime replacement objects for any proxy objects used in the nib file. In this dictionary, the keys are the names associated with the proxy objects and the values are the actual objects from your code that should be used in their place. (Deprecated. Use the
UINibExternalObjectskey instead.)Available in iOS 2.0 and later.
Deprecated in iOS 3.0.
Declared in
UINibLoading.h.UINibExternalObjectsThe value for this key is a dictionary that contains the runtime replacement objects for any proxy objects used in the nib file. In this dictionary, the keys are the names associated with the proxy objects and the values are the actual objects from your code that should be used in their place.
Available in iOS 3.0 and later.
Declared in
UINibLoading.h.
© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-03-26)