Challenge 2: sortDescriptorsDidChange is not called


I am having difficulties with sorting the NSTableView. I have added the sortDescriptorsDidChange method but it does not get called. As in the other thread, I checked that the identifiers are set for the NSTableColumn objects. Even so, when I click the header for either column, the table does not sort.

I did have to drag an NSObject into the Interface Builder window, rename it to MyDocument, then connect the NSButtons and NSTableView to the MyDocument object to get things working. Not sure if this is what was intended. The other option was to use the File’s Owner object (it is a type of MyDocument) but this did not work.

Thank you for any help,
Paul Lohr


I just want to make sure, did you put the method in by its correct name? You called it “sortDescriptorsDidChange”. Where you just abbreviating? The full name of the method is “tableView: sortDescriptorsDidChange”. Did you put it in like this:

- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)oldDescriptors

Just checking!

If it’s not getting called, are you sure you’ve set MyDocument to be the dataSource of your NSTableView?