> On 8 Apr 2016, at 10:05 PM, Nivek Research <nivek.resea...@gmail.com> wrote:
> 
> Hi Graham,
> I believe the part you are missing is the ability to use bindings and ideally 
> bindings setup in IB.


So, according to the documentation:

"NSView subclasses can expose additional key-value-coding/key-value-observing 
compliant properties as bindings by calling the class method exposeBinding: for 
each of the properties. This is typically done in the class’s initialize 
method. By exposing the bindings that an object supports and creating an 
Interface Builder palette, you can make instances of your own classes bindable 
in Interface Builder.”

If this information is still correct, then adding the following *ought* to work:

+ (void)                initialize
{
        [[self class] exposeBinding:@"selectedIndex"];
}


However, I just tried it, and IB doesn’t show the binding. I don’t use bindings 
myself, so I’m unsure what else needs to be done. The mention of IB palettes is 
woefully out of date, so maybe this is no longer supported.

Regardless, your model does not need to know about this view. Your controller 
might, and could effect the binding in code, using -[NSObject 
bind:toObject:withKeyPath:options:] and an outlet to the group view. As work 
goes, that’s pretty minimal, and affects only the controller, as it should.

> However, I am looking for a solution that requires no modification to the 
> model and especially no understanding of a custom view and its properties. 
> Ideally I would also like one that can mostly be configured from IB as one 
> would do today with NSMatrix.

Well, you can stick with NSMatrix. But unless Apple come up with something like 
this type of group view that you can bind to (if bindings for custom views 
don’t work these days), you don’t have many other options. But any code would 
be in the controller, not the model, so I don’t see that should be a problem.

—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to