直接打开ABPersonViewController在iphone EDIT模式就能直接(Direc

2019-09-16 17:37发布

我正在开发通讯录应用程序。 当用户从联系人列表中选择一个用户,我想在编辑模式下使用直接打开该记录ABPersonViewController代替clickng编辑按钮ABPersonViewController 。 我怎样才能做到这一点? 谢谢

Answer 1:

只需拨打setEditing显示视图后:

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

我从酥料饼的控制器内尝试这样的iPad和工作正常。



Answer 2:

事实上AB PersonViewController长相酷似ABPersonViewController在编辑模式。



Answer 3:

我完成了同样做这样的:

    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];


文章来源: Directly open ABPersonViewController in EDIT MODE DIRECTLY in iphone