我有一个按姓氏对通讯簿进行排序的排序功能,我需要修改此代码,使其按名字排序。我需要在哪里更改此代码。我知道这是一个简单的更改,但我无法弄清楚。这是按姓氏对联系人列表进行排序的代码
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy
(
kCFAllocatorDefault,
CFArrayGetCount(people),
people
);
CFArraySortValues
(
peopleMutable,
CFRangeMake(0, CFArrayGetCount(peopleMutable)),
(CFComparatorFunction) ABPersonComparePeopleByName,
(void*) ABPersonGetSortOrdering()
);