Re: Overriding NSTextField problem
Re: Overriding NSTextField problem
- Subject: Re: Overriding NSTextField problem
- From: Andy Lee <email@hidden>
- Date: Sun, 24 Feb 2002 08:46:56 -0500
At 2:32 PM +0100 2/24/02, Cyril Godefroy wrote:
>
Unfortunately, I get the same 'no log', and my drag & drop doesn't work, of course. I guess it is more related to my use of IB etc. That's why I really don't get it. By the way, overriding init should work (it' an object isn't it), NSviews have to call init method some day?
>
Actually, they don't. By convention, only the "designated initializer" for a given class, which is often but not always -init, is guaranteed to be called. Other initialization methods (such as -init and -initWithFrame:) are supposed to eventually call the designated initializer, not the other way around.
Note that this is a convention, not enforced by the language or the compiler, so it's up to programmers to remember to observe the convention. This is why the problem you had is a very common one -- it seems perfectly natural to override -init. It's also why I incorrectly assumed -initWithFrame: was the answer, because for NSViews it usually is.
Apologies again for putting you on the wrong track.
--Andy
_______________________________________________
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.