views:

141

answers:

0

Greetings,

I have an NSTableView with two columns that works fine... except: If I set the sort descriptor for the table in Interface Builder, things work as expected and sortDescriptorsDidChange gets called as expected. If, however, I don't set the sort descriptors in Interface Builder and instead use this:

[tableView setSortDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:) ]autorelease]]];

(where "name" is the identifier for the leftmost column) in my code, sortDescriptorsDidChange never gets invoked. As I read (misread?) Apple's documentation for NSTableView, what I am doing, I think, should work. What am I doing wrong?

P.S. I know that I could also use a NSArrayController for all this (and if I do it works fine), but for whatever reason, I have chosen not to.