« Coredata doubly-linked list | Main | Compile dar on OSX 10.4.8 »

Cocoa manual binding to selection in NSArrayController

If I want to do this manually binding.jpg
I have to do this
    [vizController bind:@"runData"
               toObject:runsController
            withKeyPath:@"selection.self"
                options:nil];
My RTFM skills lack the voodoo to find where this is documented. Is there perhaps another way?

TrackBack

TrackBack URL for this entry:
http://www.jonathansaggau.com/blog/mt-tb.cgi/93

Comments

When I was at the Cocoa bootcamp, I asked Aaron Hillegass about doing manual bindings. I specifically asked what the fields in the inspector mapped to in the bind:toObject:withKeyPath:options method call. He told me that essentially the Controller Key field and the Model Key Path field are simply concatenated in a single string with a dot in the middle. So if you Controller Key is "selection" and you Model Key Path is say "name", what actually gets used in the method invokation as the withKeyPath: is @"selection.name".

I don't know if that helps you, but it certainly made more sense to me. I don't understand why apple has two fields in there in the first place, I guess it might seem simpler to some people.

In your example, I think you might be able to cut @"selection.self" to just @"selection" (I can't test that right now since we only use windoze machines at work, but you can give it a try.)

Nope. No dice. The .self was added (as a guess, no less) because .selection doesn't work.

Exception obj = *** -[_NSControllerObjectProxy graph]: selector not recognized [self = 0x1bb57f0]

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)