This category adds methods to the Foundation framework’s
NSObject class. The method in this category provides support for loading nib files into your application.
Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
The nib-loading infrastructure sends an
awakeFromNibmessage to each object recreated from a nib archive, but only after all the objects in the archive have been loaded and initialized. When an object receives an
awakeFromNibmessage, it is guaranteed to have all its outlet and action connections already established.
You must call the
awakeFromNibto give parent classes the opportunity to perform any additional initialization they require. Although the default implementation of this method does nothing, many UIKit classes provide non-empty implementations. You may call the
superimplementation at any point during your own
During the instantiation process, each object in the archive is unarchived and then initialized with the method befitting its type. Objects that conform to the
NSCodingprotocol (including all subclasses of
UIViewController) are initialized using their
initWithCoder:method. All objects that do not conform to the
NSCodingprotocol are initialized using their
initmethod. After all objects have been instantiated and initialized, the nib-loading code reestablishes the outlet and action connections for all of those objects. It then calls the
awakeFromNibmethod of the objects. For more detailed information about the steps followed during the nib-loading process, see Nib Files in Resource Programming Guide.
Typically, you implement
awakeFromNibfor objects that require additional set up that cannot be done at design time. For example, you might use this method to customize the default configuration of any controls to match user preferences or the values in other controls. You might also use it to restore individual controls to some previous state of your application.
Available in iOS 2.0 and later.
Called when a designable object is created in Interface Builder.
When Interface Builder instantiates a class with the
IB_DESIGNABLEattribute, it calls this method to let the resulting object know that it was created at design time. You can implement this method in your designable classes and use it to configure their design-time appearance. For example, you might use the method to configure a custom text control with a default string. The system does not call this method; only Interface Builder calls it.
Interface Builder waits until all objects in a graph have been created and initialized before calling this method. So if your object’s runtime configuration relies on subviews or parent views, those objects should exist by the time this method is called.
Your implementation of this method must call
superat some point so that parent classes can perform their own custom setup.
Available in iOS 8.0 and later.
Asks the object to increase the size of an item.
The system calls this action method in response to the user pressing Command-plus (+) on an attached hardware keyboard. Typical responses for this type of event are to increase the font size of text or to change the zoom level of scroll views.
Available in iOS 7.0 and later.
Asks the object to decrease the size of an item.
The system calls this action method in response to the user pressing Command-minus (-) on an attached hardware keyboard. Typical responses for this type of event are to decrease the font size of text or to change the zoom level of scroll views.
Available in iOS 7.0 and later.