Skip navigation.
 
mlRe: subclassing NSTabViewItem
FROM : matt neuburg
DATE : Thu Jan 02 18:29:22 2003

On Thu, 2 Jan 2003 01:02:02 -0500, Jeffrey Drake <<email_removed>> 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_removed>, 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlsubclassing NSTabViewItem Jeffrey Drake Jan 2, 07:02
mlRe: subclassing NSTabViewItem matt neuburg Jan 2, 18:29
mlRe: subclassing NSTabViewItem Mike Ferris Jan 3, 18:21