我正在尝试在我的应用程序中集成新的联系人控件。这是我的代码:
- (BOOL) personViewController:(ABPersonViewController*)personView shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue
{
return YES;
}
-(IBAction)addcontact:(id)sender{
ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:picker];
[self presentModalViewController:navigation animated:YES];
[picker release];
[navigation release];
}
它会弹出新的联系人 View ,但是当我单击 时取消 或 完成按钮没有任何 react 。
谁能帮我?
提前致谢!
最佳答案
//Make sure your VC is an <ABNewPersonViewControllerDelegate>
-(void) newPersonViewController:(ABNewPersonViewController *)newPersonView
didCompleteWithNewPerson:(ABRecordRef)person {
if (person != nil) //nil = Cancel button clicked
{
//do something
}
//iOS6
[self dismissViewControllerAnimated:YES completion:nil];
}
关于iphone - 取消和完成按钮在新联系人 View 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4222128/