Re: When do NSImageRep subclasses register themselves?
Re: When do NSImageRep subclasses register themselves?
- Subject: Re: When do NSImageRep subclasses register themselves?
- From: Chaz McGarvey <email@hidden>
- Date: Thu, 1 Apr 2004 15:43:12 -0700
On Apr 1, 2004, at 9:52 AM, lbland wrote:
On Apr 1, 2004, at 11:02 AM, Kevin Ballard wrote:
Is this true? Can you assume in a subclass's +load that its super has
already loaded?
from the NSObject docs:
"The order in which classes are loaded is also not guaranteed, to the
point that superclasses arent even guaranteed to be loaded before
all of their subclasses. Because you cant rely on other classes
being loaded at the point when your class is sent a load message, you
should be extremely careful when sending messages to other classes
from within your load method."
Yes, exactly. That's the thing that makes me wonder how these
subclasses are registering themselves. The reason I care enough to
ask is because I'm interesting in designing some of my own classes for
loading a different type of file in a similar fashion to how the
NSImageRep system of class/subclasses works.
I thought that perhaps NSApplication registers them, but that doesn't
go along with my thoughts on how object-oriented code should work.
Can anyone else think of any other ways they might be doing this?
OK, the 'official' NSImageRep subclasses are apparently registered in
+[NSImage initialize]. To figure this out I just set a breakpoint at
+[NSImageRep registerImageRepClass:] and checked the stack. I could
have just figured this out without bothering the list, but I get good
(or obvious) ideas by talking to the list sometimes. ;)
So I guess, in theory, that means that it's not a good thing to use
NSImageRep without using NSImage first. For my test app, NSImage was
initialized while a nib was loading. So I guess the thing to do is to
just keep this in mind.
Thanks for your comments,
Chaz McGarvey
http://www.brokenzipper.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.