• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Clean NSWindowController / NSObjectController architecture
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clean NSWindowController / NSObjectController architecture


  • Subject: Clean NSWindowController / NSObjectController architecture
  • From: Pierre DOUCY <email@hidden>
  • Date: Wed, 12 Mar 2008 08:43:01 -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


  • Prev by Date: Re: NSPersistentDocument Tutorial
  • Next by Date: Re: Setting the badgeValue in ToolbarItem in ViewController file.
  • Previous by thread: Re: Setting the badgeValue in ToolbarItem in ViewController file.
  • Next by thread: Clean NSWindowController / NSObjectController architecture
  • Index(es):
    • Date
    • Thread