Re: subclassing NSTabViewItem
Re: subclassing NSTabViewItem
- Subject: Re: subclassing NSTabViewItem
- From: Mike Ferris <email@hidden>
- Date: Fri, 3 Jan 2003 09:21:52 -0800
FYI, You can pose at any time. The catch is that posing affects only
new instances created after the pose.
But Matt is right that this is probably not a good situation for
posing. Posing should usually be considered only as a last resort.
Mike
Begin forwarded message:
From: matt neuburg <email@hidden>
Date: Thu Jan 2, 2003 9:29:22 AM US/Pacific
To: Jeffrey Drake <email@hidden>
Cc: email@hidden
Subject: Re: subclassing NSTabViewItem
On Thu, 2 Jan 2003 01:02:02 -0500, Jeffrey Drake <email@hidden>
said:
@interface JDTabViewItem : NSTabViewItem
- (void)drawLabel:(BOOL)shouldTruncateLabel inRect:(NSRect)tabRect;
- (NSSize)sizeOfLabel:(BOOL)shouldTruncateLabel;
@end
To set it all up:
+ (void)initialize
{
[JDTabViewItem poseAsClass: [NSTabViewItem class]];
}
According to all the information I have this should work. Debugging
indicates that initialize is being called fine, but the two functions
above are not.
Is there something I am missing?
On my understanding of the docs, if you're going to pose you must do
it *before* initialize is ever called. By the time initialize is
called it's too late. I could be wrong about this, but I've always
made this assumption and I've never had any trouble posing.
I don't understand, though, in any case why you've confused yourself
by posing in the first place. If you want to subclass, subclass, and
declare particular nib instances to be instances of the subclass, and
test it that way; you can always change tactics and pose if you decide
that's more efficient later on (i.e. because you want *every* instance
of this class to be an instance of the subclass).
Incidentally, it is unnecessary to declare inherited superclass
functions in the @interface as you do above. The compiler knows about
them already (because they are inherited). m.
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.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.
_______________________________________________
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.