I'm building a Core Data document based application. In the app there's a main view (NSTableView) and an inspector view. Both views are separate nib files. The content of the inspector view should depend on the selected row in the main view. I have three controller files:
- DocumentWindowController (master controller)
- ItemsViewController (main view)
- SchedulesViewController (part of the inspector)
Every controller owns a nib file. How is it possible to change the content of the inspector when the user selects another row in the main view's table?
I tried to make it work as follows:
- Every controller has it's own NSArrayController, which is set up in the DocumentWindowController. The DocumentWindowController gets its managedObjectContext from [[self document] managedObjectContext]
- When a user clicks a row in the ItemsViewController's tableView, an NSNotification is posted, with [NSTableView selectedRow] as a parameter. Then a fetch request is being made.
My intuition says I have to do this with Cocoa bindings. I searched on Stackoverflow and google but I just can't make it work. If everything is in one nib file is very easy to accomplish. What is the best/most used way to achieve this?
Thanks in advance!