On Jul 1, 2009, at 12:54 AM, Quincey Morris wrote:

On Jul 1, 2009, at 00:28, Thomas Davie wrote:

On 1 Jul 2009, at 09:21, Debajit Adhikary wrote:

(Is it enough to place a generic NSView there and add a subview each time?
I'm fairly new to Cocoa, so any pointers are welcome)

Yes -- at least that's what I do, if I'm doin it rong, hopefully someone will tell me :)

As others have said, using a tabless NSTabView is generally easier, though if you need to actually release the view which isn't currently in the window, this technique doesn't do that. (Typically you don't need to release it.)

I'm curious as to why people recommend a tabless NSTabView for this. I've always found tabview subviews to be a pain to set up in IB; the alignment and sizing seem really fiddly to get right. Maybe I've been doing something wrong.

In Leopard (and the iPhone, I guess), the easier way is to use a NSViewController, because it handles nib object ownership issues for you. The view controller loads the nib for you, though you still need to swap the subviews manually.

The other advantage of NSViewController is that if your subviews each need some controller logic, it modularizes your code if you can move it to the NSViewController, instead of having to dump it all in the window controller.

This is the way I'd recommend, although it's not that bad even without NSViewController. Using multiple nibs instead of building one really complicated nib has some distinct benefits for maintenance, in my experience.

--
Adam

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to