按照苹果公司的快速联系人示例代码使用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的子类化。任何建议都是非常感谢的!
发布于 2011-03-24 11:49:39
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 shouldPerformDefaultActionForPerson:
https://stackoverflow.com/questions/5414378
复制相似问题