Re: my class initialize is being called multiple times
Re: my class initialize is being called multiple times
- Subject: Re: my class initialize is being called multiple times
- From: Allan Hsu <email@hidden>
- Date: Thu, 8 Jun 2006 12:56:07 -0700
The class initializer will be called for every subclass that does not
have its own initialize as well. The pattern you need to follow looks
something like this:
+ (void)initialize {
if(self != [MyClass class])
return;
(insert code here)
}
This is documented in the NSObject class documentation:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/clm/
NSObject/initialize
-Allan
--
Allan Hsu <allan at counterpop dot net>
1E64 E20F 34D9 CBA7 1300 1457 AC37 CBBB 0E92 C779
On Jun 8, 2006, at 12:49 PM, Graham wrote:
I have a class with a class initializer:
+ (void)initialize;
And it getting called multiple times (which is obviously causing
problems for me).
How is this possible?
The class does have several subclasses, not that that should matter.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40counterpop.net
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden