I'm working on window restoration in a non-document-based Cocoa app. The app has a Mail.app-like interface. Each window represents an account; a sidebar in that window lists conversations in that account, and a main area lists messages in the selected conversation.
Each of these lists is a view-based NSTableView
. The conversation list is bound to an NSArrayController
whose contentSet
is bound to the window controller's account
property; the message list is bound to a second NSArrayController
, whose contentSet
is bound to the first NSArrayController
's selection.
I've gotten my window restoration work to the point where it re-opens all the windows and re-associates them with the account objects, but I don't know how to restore the selections of the table views. This doesn't seem to happen automatically—when the window is restored, an object is selected, but it's not the one that was previously selected. What's going on here? What will be the easiest approach to saving and restoring the selection?