Alterplay / APAddressBook

Easy access to iOS address book
MIT License
1.38k stars 193 forks source link

Sort by firstname: case sensitive #92

Closed JonMo closed 9 years ago

JonMo commented 9 years ago

Hello,

When i use the sort method by firstnames, It creates two list differentiated by the uppercase and lowercase of the first letter of the firstname, example: Aaron Barbara Mark Victoria alfred charles jim nancy

How can i solve this case sensitivity issue? Thanks

belkevich commented 9 years ago

Hello,

Here is Apple's NSSortDescriptor guide. Use case insensitive compare

JonMo commented 9 years ago

Great! Thank you

addressBook.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"firstName" ascending:YES selector:@selector(caseInsensitiveCompare:)],
                                [NSSortDescriptor sortDescriptorWithKey:@"lastName" ascending:YES selector:@selector(caseInsensitiveCompare:)]];