• 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
Re: Correct use of NSViewController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct use of NSViewController


  • Subject: Re: Correct use of NSViewController
  • From: Paul Szego <email@hidden>
  • Date: Fri, 21 Mar 2008 11:27:30 +1300


On 21/03/2008, at 12:35 AM, Jonathan Dann wrote:


Hi Cathy,

Thanks again for your advice. I've got it working now and I'm almost back I where I was before refactoring, I'm now running into a bindings problem.

Before using the view controllers I had put 2 tree controllers in my window controller's nib, 2 outline views were then bound to these and the tree controllers themselves got their content from an object controller that was bound to the the keypath [(Window Controller)File's Owner].document. So the object controller was a proxy for my document and the tree controllers had shorter keypath to traverse to get to the array they needed in my document subclass.

Now when I do this I have the tree controllers and the document proxy object controller in my view controller's nib. The only way I can see to getting to the document is using the keypath


Have you considered using the representedObject property of the NSViewController?

To quote the API docs for NSViewController:

"...a generic representedObject property, to make it easy to establish bindings in the nib to an object that isn't yet known at nib-loading time or readily available to the code that's doing the nib loading."

In my code I create the view controller from the window controller, then set the representedObject. In my case it's usually the document, since I have the necessary controller objects in the document so that I can share selection status across various windows and views from different NIB's easily (remember that NSDocument is part of the *controller* layer in MVC, not the model).

HTH, Paul.

_______________________________________________

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


References: 
 >Correct use of NSViewController (From: Jonathan Dann <email@hidden>)
 >Re: Correct use of NSViewController (From: Cathy Shive <email@hidden>)
 >Re: Correct use of NSViewController (From: Jonathan Dann <email@hidden>)
 >Re: Correct use of NSViewController (From: Cathy Shive <email@hidden>)
 >Re: Correct use of NSViewController (From: Jonathan Dann <email@hidden>)

  • Prev by Date: Re: extract text from image
  • Next by Date: Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)
  • Previous by thread: Re: Correct use of NSViewController
  • Next by thread: Re: Correct use of NSViewController
  • Index(es):
    • Date
    • Thread