Challenge 2: sortDescriptorsDidChange is not called


#1

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.

https://docs.google.com/leaf?id=0BwSEg-i8ChhRZGM3MDgyZWQtZWIyZS00MTQ0LWE1MzAtMTRhYmQ2YTAzNGVl&hl=en_US&authkey=CM_4k_8K

Thank you for any help,
Paul Lohr


#2

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?