Re: Subclassing NSTableView
Re: Subclassing NSTableView
- Subject: Re: Subclassing NSTableView
- From: Stefan Arentz <email@hidden>
- Date: Sun, 27 May 2001 19:59:20 +0200
On Sun, May 27, 2001 at 06:15:28PM +0200, Stefan Arentz wrote:
>
I'm trying to subclass NSTableView, but neither init or
>
initWithFrame: are being called in my implementation. So
>
what is the correct place to put my own initialization
>
code?
Ok I found an answer. I'll share it :-)
When you subclass an object like NSTableView and then use it in
IB, then the object will never be instantiated with init or
initWithFrame:. Instead initWithCoder: will be called, because
the object is realy archived in the nib.
So there are two things you can do. You can add your own
initialization code in initWithCoder: or awakeFromNib. The latter
sounds like the correct place imo.
Oh, it works great now. I just finished a NSTableView subclass
that adds the logic for column sorting, including asking the
delegate to do the sorting.
[ObjC rules];
Stefan