Sorting in RaiseMan

You are now ready to add sorting to RaiseMan. When you are done, the user will be able to reorder the employees table by clicking on the table column headers. This action translates to setting the criteria by which the rows will be sorted.

When a user clicks on a table column header, the table view responds by changing its sort descriptors. Sort descriptors, represented by the NSSortDescriptor class, describe how to sort an array of objects. Each sort descriptor contains a key which is a KVC key path, whether it should be ascending (as opposed to descending), and a comparison selector, or method used to compare the two keys. Because sorting with NSSortDescriptor relies upon KVC, it can only be used with NSObject ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.