Directly open ABPersonViewController in EDIT MODE DIRECTLY on iphone

I am developing an address book application. When a user selects a user from the contact list, I want to open this entry directly in EDIT mode using the ABPersonViewControllerbutton instead of the "Edit" button ABPersonViewController. How can i achieve this? Thanks

+3
source share
3 answers

Just call setEditing after displaying the view:

ABPersonViewController *ab = [[ABPersonViewController alloc] init];
ab.allowsEditing = YES;
// customize as you see fit
[self.navigationController pushViewController:ab animated:YES];
[ab setEditing:YES animated:NO];

I tried this on an iPad using a popover controller and it works fine.

+2
source

In fact, the AB New PersonViewController looks exactly like the ABPersonViewController in edit mode.

+1

I did the same by doing the following:

    ABRecordID personId = (ABRecordID)contact_ID;// if you want to edit a particular record and you're maintaining contact ID somewhere in your project.
    ABPersonViewController *contactVC = [[ABPersonViewController alloc] init];
    contactVC.personViewDelegate = self;// set your ViewController as delegate
    contactVC.allowsEditing = YES; //set NO if you don't wanna allow editing
    contactVC.displayedPerson = ABAddressBookGetPersonWithRecordID(addressBook, personId);
    [self.navigationController presentViewController:contactVC animated:YES completion:nil];
-2
source

All Articles