views:

29

answers:

1

I have a NSDictionaryController whose content is bound to a NSMutableDictionary, both initialized and connected in Interface Builder. After a certain IBAction is called, the contents of the dictionary are programmatically modified. The NSTableView, which is hooked up with Cocoa bindings to the NSDictionaryController, does not get updated despite the fact that NSLogging the dictionary shows those updates.

The only way I've found to fix this is to execute the following block right after the dictionary is modified:

id t = self.content; self.content = nil; self.content = t;

Even though I can tell that this is a KVC/KVO issue, I'm not experienced enough in either to know how to proceed from here. Does anyone know a cleaner, more Cocoa-like way of handling this?

A: 

Call

[tableView reloadData];

from inside your delegate after you've updated the data. (Replace "tableView" with the NSTableView instance in your delegate.)

See NSTableView Reference's reloadData

Edit: I imagine for an NSDictionaryController reloadData won't do much. Check http://www.cocoadev.com/index.pl?NSTableViewNotReloadingCorrectly .

cygnl7