我正在开发通讯录应用程序。当用户从联系人列表中选择用户时,我想使用ABPersonViewController
而不是ABPersonViewController
的clickng编辑按钮直接在编辑模式下打开该记录。我怎样才能做到这一点?感谢
答案 0 :(得分:2)
在显示视图后调用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上试过这个并且工作正常。
答案 1 :(得分:1)
实际上AB 新 PersonViewController在编辑模式下看起来与ABPersonViewController完全相同。
答案 2 :(得分:-2)
我通过这样做完成了同样的事情:
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];