Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField subclass - not using NSTextFieldCell subclass when unarchived from nib?




On Jul 29, 2006, at 9:03 AM, Jim Correia wrote:

I have two subclassses:

MyTextField
MyTextFieldCell

I've dragged an NSTextField out into my window in IB, and set its custom class to MyTextField.

In the MyTextField implementation I've tried both (and at the same time)

+ (void)initialize
{
	if (self == [MyTextField class]) {
		[self setCellClass: [MyTextFieldCell class]];
	}
}

+ (Class)cellClass
{	
	return [MyTextFieldCell class];
}

Still, NSTextFieldCell is used, and not my subclass. (Strangely, I do not run into the same problem with subclassing NSTokenField/ NSTokenFieldCell.)

What have I overlooked?

How can I get MyTextFieldCell to be used as the cell for MyTextField when unarchived from a nib?

When subclassing NSTextField/NSTextFieldCell, you'll also need to ensure that the field editor will use your subclasses as well.


I don't remember any specific code examples on this, but I know it's listed in the archives.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSTextField subclass - not using NSTextFieldCell subclass when unarchived from nib? (From: Jim Correia <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.