Re: Binding to a view's model object
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