O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sort the Table

One of the features of MyContactList is to be able to sort the table by different criteria as specified on the Settings screen. The code changes to enable sorting are relatively minor because the Core Data framework handles the heavy lifting. You need to import Constants.h and then make changes to loadDataFromDatabase: in LMAContactsTableController.m, as shown in Listing 12.13.

Listing 12.13 Enable Sorting of the Table

- (void) loadDataFromDatabase{    //read settings to enable sorting    NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];           //1    NSString *sortField = [settings stringForKey:kSortField];                   //2    bool sortAscending = [settings boolForKey:kSortDirectionAscending ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required