例如表格单元格具有:
联系人图片
联系人姓名。
我发现我们必须使用框架:
地址簿框架
AddressBookUI.framework
我怎样才能做到这一点?
例如表格单元格具有:
联系人图片
联系人姓名。
我发现我们必须使用框架:
地址簿框架
AddressBookUI.framework
我怎样才能做到这一点?
ABAddressBookRef addressBook = ABAddressBookCreate(); // create address book reference object
NSArray *abContactArray = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); // get address book contact array
NSInteger totalContacts =[abContactArray count];
for(NSUInteger loop= 0 ; loop < totalContacts; loop++)
{
ABRecordRef record = (ABRecordRef)[abContactArray objectAtIndex:loop]; // get address book record
if(ABRecordGetRecordType(record) == kABPersonType) // this check execute if it is person group
{
ABRecordID recordId = ABRecordGetRecordID(record); // get record id from address book record
NSString *recordIdString = [NSString stringWithFormat:@"%d",recordId]; // get record id string from record id
NSString *firstNameString = (NSString*)ABRecordCopyValue(record,kABPersonFirstNameProperty); // fetch contact first name from address book
NSString *lastNameString = (NSString*)ABRecordCopyValue(record,kABPersonLastNameProperty); // fetch contact last name from address book
}
}
更多检查这些链接