Question

I am developing an app in which I have to allow user to edit the contact programatically.

I googled about it

I found that ABPersonViewController will be used. I am not able to find it how to implament it.

Address Book Programming Guide for iPhone OS also didnt work for me.

Can you suggest me the way to do it.

Thnx in advance

Was it helpful?

Solution

Ok at last i have to find the solution myself

here is it

-(IBAction)showPicker:(id) sender{
    ABAddressBookRef addressBook = ABAddressBookCreate();
    CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);  
    ABRecordRef person = CFArrayGetValueAtIndex(allPeople,0);   
    ABPersonViewController *personController = [[ABPersonViewController alloc] init];
    personController.displayedPerson = person;
    personController.addressBook = addressBook;
    personController.allowsEditing = YES;
    personController.personViewDelegate = self;
    UINavigationController *contactNavController = [[UINavigationController alloc] initWithRootViewController:personController];
    [personController release]; 
    CFRelease(allPeople);
    CFRelease(person);

    [self presentModalViewController:contactNavController animated:YES];    
}


-(void)personViewControllerDidCancel:(ABPersonViewController *)peoplePicker
{
    [self dismissModalViewControllerAnimated:YES];
}

-(BOOL)personViewController:(ABPersonViewController *)peoplePicker shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID) property identifier:(ABMultiValueIdentifier) identifier
{
    return YES;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top