Re: designing beyond MV and (one) C
Re: designing beyond MV and (one) C
- Subject: Re: designing beyond MV and (one) C
- From: Ken Thomases <email@hidden>
- Date: Sat, 19 Jan 2008 20:25:15 -0600
On Jan 15, 2008, at 5:40 PM, Daniel Child wrote:
On Jan 14, 2008, at 4:19 AM, Uli Kusterer wrote:
The rest of the app would just talk to the subclass through the
generic controller's interface. If there is only one window, one
window controller would be enough. If you only have very, very
simple windows, and you don't open several instances of the same
window, you may even get away without a window controller and just
hide and show the windows as needed.
I have been doing the latter, and am still trying to figure out what
advantage there is to a window controller. What can it do that a
regular controller can't, and vice versa....? I'm still failing to
see their whole reason for being in non-document app cases.
The main advantage of using NSWindowController in a non-document app
is management of the top-level objects of your nib.
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemMgmtNibObjects.html
Something which is not documented on the above page is that bindings
often cause retain cycles among nib objects. For example, if a
control in the window is bound to or through a property of the File's
Owner, then the File's Owner is implicitly retained. As a
consequence, it becomes difficult to properly release the owner and
all of the nib's objects. Since 10.4, NSWindowController has built-in
smarts for breaking that retain cycle.
For a nib which contains a standalone view (not contained in a
window), 10.5 introduces NSViewController whose purpose is roughly the
same. See:
http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSViewController
Regards,
Ken Thomases
_______________________________________________
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