Re: How to load a window
Re: How to load a window
- Subject: Re: How to load a window
- From: "Michael Ash" <email@hidden>
- Date: Mon, 22 Sep 2008 00:21:43 -0400
On Sun, Sep 21, 2008 at 4:58 PM, Nick Zitzmann <email@hidden> wrote:
>
> On Sep 21, 2008, at 2:53 PM, Eric Lee wrote:
>
>> On CocoaDevCentral, they say to use NSBundle, but I read on the
>> documentation that you can also use NSWindowController?
>
> NSBundle has the master methods for loading nibs into memory.
> NSWindowController uses NSBundle internally. Generally, if your nib has only
> a window + its views + some affiliated resources in it, then you should
> probably use (or subclass, if you want to do anything fancy)
> NSWindowController.
I would go farther with this and say that, as long as you're targeting
10.5+, you should always load nibs using NSWindowController or
NSViewController. If you find yourself in a situation where neither
one is appropriate, it's probably a sign that you need to rework how
your nibs are set up or how your code is designed, not a sign that you
should use NSBundle's nib loading mechanism.
No doubt there are *some* cases where it makes sense to load a nib
manually, but my experience has been that NSViewController has covered
every reasonable case that NSWindowController left out.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden