+(void) initialize in objective-c class static variables constructor +(void) initialize in objective-c class static variables constructor objective-c objective-c

+(void) initialize in objective-c class static variables constructor


This +initialize method is described in The Objective-C Programming Language.

The runtime system sends an initialize message to every class object before the class receives any other messages and after its superclass has received the initialize message. This gives the class a chance to set up its runtime environment before it’s used. If no initialization is required, you don’t need to write an initialize method to respond to the message.

For example, when [DecimalPointButton alloc] is called, the runtime will check if [DecimalPointButton initialize] has been called. If not, it will +initialize the class. This ensure the backgroundImageDepressed image is ready before any instances of DecimalPointButton are constructed.