I found some sample code from here.
static UIImage *backgroundImageDepressed;
/**
*
*/
@implementation DecimalPointButton
+ (void) initialize {
backgroundImageDepressed = [[UIImage imageNamed:@"decimalKeyDownBackground.png"] retain];
}
Is it something like this – +(void) initialize method initialize static variables of a class ( interface ) in Objective C? I have never seen this before.
This
+initializemethod is described in The Objective-C Programming Language.For example, when
[DecimalPointButton alloc]is called, the runtime will check if[DecimalPointButton initialize]has been called. If not, it will+initializethe class. This ensure thebackgroundImageDepressedimage is ready before any instances of DecimalPointButton are constructed.