• 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: Binding to a view's model object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding to a view's model object


  • Subject: Re: Binding to a view's model object
  • From: Jonathan Mitchell <email@hidden>
  • Date: Sun, 25 Jan 2015 11:42:09 +0000


> On 25 Jan 2015, at 10:34, Roland King <email@hidden> wrote:
>
> I have a xib with a top-level view and a bunch of subviews which represents one view of a given model object. The top-level NSView subclass has a readwrite property which is the model object of which it's a view. I thought this was a pretty standard pattern, especially in OSX which only just recently started to really make use of view controllers.
>
I would embrace NSViewController and use -representedObject.
Bindings + MVC have an established track record  and it does correct memory management that can be tricky to get right otherwise.
Your pattern is not very MVC at the moment!

>  I can bind to files owner, the shared defaults controller and the application only, or to any other standalone Object I put in the NIB, but none of those help.


You can if your file’s owner has an outlet for the top level view (NSViewController does of course):

myFilesOwner.myTopLevelView.myObject.myProperty

Jonathan
_______________________________________________

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: 
 >Binding to a view's model object (From: Roland King <email@hidden>)

  • Prev by Date: Adding constrains for anonymous buttons
  • Next by Date: Re: Binding to a view's model object
  • Previous by thread: Re: Binding to a view's model object
  • Next by thread: Re: Binding to a view's model object
  • Index(es):
    • Date
    • Thread