Search code examples
objective-cobjective-j

Objective-C: sortDescriptorsDidChange argument?


I don't get why sortDescriptorsDidChange takes an argument oldDescriptors if it is never used in the method.

- (void)tableView:(CPTableView)aTableView sortDescriptorsDidChange:(CPArray)oldDescriptors {
   [result sortUsingDescriptors:[aTableView sortDescriptors]];
   [aTableView reloadData];
}

What am I missing ?


Solution

  • sortDescriptionDIdChange is a delegate, so you can implement your own behavior for it.

    For example, you could use oldDescription along with the new description to manually calculate the changes and provide a nice animation for them. Or to implement specific behavior if the order didn't change etc. etc.