Categories and +initialize
Categories and +initialize
- Subject: Categories and +initialize
- From: Norbert Heger <email@hidden>
- Date: Sun, 06 Jan 2002 18:32:07 +0100
A few days ago it was stated on this list, that categories can have their
own +initialize method:
John C. Randolph wrote:
>
Also, categories can have an +initialize method as well, which
>
will be called before any other method in that category.
Indeed, the +initialize method of a category will be called, but only due to
the fact that the category implementation *overrides* the class's previous
implementation (if existent).
I just ran into that problem by implementing + initialize in an NSFont
category, which caused my app to break entirely, since the original +[NSFont
initialize] method was no longer called. Therefore, if you want to perform
some category specific initialization, you should implement +load instead.
Best Regards, Norbert
_____________________________________________
Norbert Heger, Objective Development
http://www.obdev.at/