Class: UINib

Inherits:
NSObject show all

Overview

Instances of the UINib class serve as object wrappers, or containers, for Interface Builder nib files. An UINib object caches the contents of a nib file in memory, ready for unarchiving and instantiation. When your application needs to instantiate the contents of the nib file it can do so without having to load the data from the nib file first, improving performance. The UINib object can automatically release this cached nib data to free up memory for your application under low-memory conditions, reloading that data the next time your application instantiates the nib. Your application should use UINib objects whenever it needs to repeatedly instantiate the same nib data. For example, if your table view uses a nib file to instantiate table view cells, caching the nib in a UINib object can provide a significant performance improvement.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Class Method Details

+ (UINib) nibWithData(data, bundle:bundleOrNil)

Creates an UINib object from nib data stored in memory. The UINib object looks for the nib file in the bundle's language-specific project directories first, followed by the Resources directory.The preferred mechanism for instantiating UINib objects is with the nibWithNibName:bundle: class method. A UINib object instantiated using the nibWithData:bundle: class method cannot release the cached data under low memory conditions. Your application should be prepared to release the UINib object and the data under low memory conditions, recreating both the next time the application needs to instantiate the nib.

Parameters:

  • data (NSData)

    A block of memory that contains nib data.

  • bundleOrNil (NSBundle)

    The bundle in which to search for resources referenced by the nib. If you specify nil, this method looks for the nib file in the main bundle.

Returns:

  • (UINib)

    The initialized NSNib object or nil if there were errors during initialization.

+ (UINib) nibWithNibName(name, bundle:bundleOrNil)

Returns an UINib object initialized to the nib file in the specified bundle. The UINib object looks for the nib file in the bundle's language-specific project directories first, followed by the Resources directory.

Parameters:

  • name (String)

    The name of the nib file, without any leading path information.

  • bundleOrNil (NSBundle)

    The bundle in which to search for the nib file. If you specify nil, this method looks for the nib file in the main bundle.

Returns:

  • (UINib)

    The initialized UINib object or nil if there were errors during initialization or the nib file could not be located.

Instance Method Details

- (Array) instantiateWithOwner(ownerOrNil, options:optionsOrNil)

Unarchives and instantiates the in-memory contents of the receiver’s nib file, creating a distinct object tree and set of top level objects. You can use this method to instantiate the objects in a nib and provide them to your code. This method unarchives each object, initializes it, sets its properties to their configured values, and reestablishes any connections to other objects. 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 Name field of the Interface Builder inspector window.

Parameters:

  • ownerOrNil (Object)

    The object to use as the owner of the nib file. If the nib file has an owner, you must specify a valid object for this parameter.

  • optionsOrNil (Hash)

    A dictionary containing the options to use when opening the nib file. For a list of available keys for this dictionary, see NSBundle UIKit Additions Reference.

Returns:

  • (Array)

    An autoreleased NSArray object containing the top-level objects from the nib file.