0
如何將聯繫人添加到'人員'數組然後到abrecordref。其實我想在tableview中的所有聯繫人,並能夠編輯個人記錄。這裏是我的代碼:在ABRecordRef中添加數組形式的所有人
-(void)showPersonViewController
{
// Fetch the address book
ABAddressBookRef addressBook = ABAddressBookCreate();
// Search for the person named "rubal" in the address book
NSArray *people = (NSArray *)ABAddressBookCopyPeopleWithName(addressBook, CFSTR("naina"));
// Display "KETAN" information if found in the address book
if ((people != nil) && [people count])
{
ABRecordRef person = (ABRecordRef)[people objectAtIndex:0];
ABPersonViewController *picker = [[[ABPersonViewController alloc] init] autorelease];
picker.personViewDelegate = self;
picker.displayedPerson = person;
// Allow users to edit the person’s information
picker.allowsEditing = YES;
[self.navigationController pushViewController:picker animated:YES];
}
else
{
// Show an alert if "KETAN" is not in Contacts
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Could not find naina in the Contacts application"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert release];
}
[people release];
CFRelease(addressBook);
}
,而不是隻有「奈娜」我想在表視圖所有記錄和編輯在ABPerson類參考單獨