Clean NSWindowController / NSObjectController architecture
Clean NSWindowController / NSObjectController architecture
- Subject: Clean NSWindowController / NSObjectController architecture
- From: Pierre DOUCY <email@hidden>
- Date: Tue, 11 Mar 2008 21:47:23 -0400
Hi all,
I have a core data, document-based app, in which a document consists
in a main window displaying a list. Clicking an item on this list
opens a new window (B) with some details specific to the clicked item.
To open window B, I do the following :
I instantiate a custom subclass of NSWindowController, which in turn:
1) Instantiate an NSObjectController which contains the document's
managed object context, and a some information regarding the item that
was clicked so that we're displaying the right data on the new window,
and
2) Loads the NIB file, setting the aforementioned NSObjectController
as the nib owner.
Using a NSObjectController seemed clean as it is key-value-coding
compliant, and thus allows me to pass along my data and bind my UI
objects easily and without writing too much code.
But now, how do I cleanly set outlets and actions for this NIB ?
Subclassing NSObjectController seems to defeat the purpose of using
this class in the first place, and making my NSWindowController
subclass the NIB owner makes me write (in my opinion) more code than
is needed.
So what is the most common practice in these situations ? Instantiate
a class in the NIB that will take care of user interaction ? Or have I
missed something ?
Thank you in advance for your answers.
Pierre DOUCY
_______________________________________________
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