I'm struggling with a case to use Cocoa Bindings between view controllers in separate files. I've checked some links for inspiration but still not there. I figured it's better to post a question and rest my mind a bit...
Similar topics: Binding selection across multiple view controllers in a single window interface
Sharing an NSArrayController between multiple views in separate NIB files
I have one main controller MainViewController.m/.h/.xib
with two custom views.
There's also a separate view controller SecondViewController.m/.h/.xib
. Its xib contain a table view basically, together with an ArrayController which is bound to the table view's column. This works fine with bindings and selection etc.
Now back in my main controller, I'd like to access the selection index from SecondViewController
for the table view.
My attempt thus far
In my main XIB, I created a ViewController in IB and set custom class and nib file to
SecondViewController
.Created an ArrayController in
SecondViewController
's XIB, whose contentArray is set to the KVC list property 'lists'. This displays the content correctly in the table view, as mentioned above.Q: how do I setup bindings in my MainViewController in such a way that I can access the object selected in
SecondViewController
? Because I want to draw the details for that object as subviews from my main view controller. Kind of a master-detail interface described in the Cocoa Tutorials.