Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c ABPersonViewController已完成编辑通知_Objective C_Ios_Addressbook - Fatal编程技术网

Objective c ABPersonViewController已完成编辑通知

Objective c ABPersonViewController已完成编辑通知,objective-c,ios,addressbook,Objective C,Ios,Addressbook,根据Apple的Quick Contacts示例代码使用ABPersonViewController ABRecordRef person = (ABRecordRef)[people objectAtIndex:0]; ABPersonViewController *picker = [[[ABPersonViewController alloc] init] autorelease]; picker.personViewDelegate = self; picker.

根据Apple的Quick Contacts示例代码使用ABPersonViewController

ABRecordRef person = (ABRecordRef)[people objectAtIndex:0];
    ABPersonViewController *picker = [[[ABPersonViewController alloc] init] autorelease];
    picker.personViewDelegate = self;
    picker.displayedPerson = person;
    picker.allowsEditing = YES;
    [self.navigationController pushViewController:picker animated:YES];
我需要一种方式来通知选择器已完成编辑或已关闭,以便我可以更新数据存储中的一些缓存值

苹果的文档建议不要将ABPersonViewController子类化。非常感谢您的任何建议

    ABPersonViewController *personViewController = [[ABPersonViewController alloc] init];

        personViewController.personViewDelegate = self;
        personViewController.displayedPerson = person; 
        personViewController.allowsEditing=YES;
        personViewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back",nil) style:UIBarButtonItemStylePlain target:self action:@selector(ReturnFromPersonView)] ;
        [self.navigationController pushViewController:personViewController animated:YES];
        [personViewController release];
然后编写您的ReturnFromPersonView方法和委托方法

- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue
{
        // you can write you code here with  [self.navigationController popViewControllerAnimated:YES];
        return YES;     
}
如果您不喜欢“后退按钮”方法-您可以将代码直接写入personViewController ShouldPerformanceDefaultActionforPerson:

谢谢:)我通过最小化核心数据中的冗余存储(仅保留记录ID以供参考)来避免此问题以及在需要时检索通讯簿值以维护最新的值。