嗨,我有一个功能,我将从书籍列表中收集名字姓氏和电话号码
- (void)getnames
{
ABAddressBookRef addressBook = ABAddressBookCreate();
if (addressBook != nil)
{
NSLog(@"Succesful.");
NSArray *allContacts = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
NSUInteger i = 0;
for (i = 0; i < [allContacts count]; i++)
{
ABRecordRef contactPerson = (__bridge ABRecordRef)allContacts[i];
NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty);
NSString *lastName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonLastNameProperty);
NSLog(@"FirstNAme::::: LastNAME::::::EMail::: %@ %@",firstName,lastName);
}
所以从上面的函数中,当我签入NSLog时,我得到了很多名字和姓氏列表。所以我的要求是如何以数组或列表的形式在下面的DisplayNames函数中显示所有名字和姓氏。所以谁能告诉我代码。我如何从上面的函数中收集所有名字和姓氏。
-(void)Displaynames
{
}