[英]iOS ABPersonViewController
I have a tab bar app and in the first tab I have some buttons and a table view which is populated with contact info from Address Book. 我有一个标签栏应用程序,在第一个标签中,我有一些按钮和一个表格视图,其中填充了通讯簿中的联系信息。 I am trying to show the contact info using the ABPersonViewController
as a modal view when the accessory button of a cell is tapped. 我试图在点击单元格的附件按钮时使用ABPersonViewController
作为模式视图显示联系信息。 I am able to show the contact info but there is no cancel button to dismiss the modal view. 我可以显示联系信息,但是没有取消按钮可以关闭模式视图。 Can someone look at the code below and let me know what I am missing. 有人可以看看下面的代码,让我知道我所缺少的吗。
ABRecordRef person = (ABRecordRef)[[self peopleList] objectAtIndex:[indexPath row]];
if (ABRecordGetRecordID(person) != kABRecordInvalidID)
{
ABPersonViewController *personViewController = [[ABPersonViewController alloc]
init];
personViewController.displayedPerson = person;
personViewController.allowsActions = YES;
personViewController.navigationItem.title=@"Contact Info";
UINavigationController *navigationController =
[[UINavigationController alloc]initWithRootViewController:personViewController];
[self presentModalViewController:navigationController animated:YES];
[personViewController release];
}
Per the docs , "Person view controllers must be used with a navigation controller in order to function properly." 根据文档 ,“人员视图控制器必须与导航控制器一起使用才能正常运行。”
ABPersonViewController *personViewController = [[ABPersonViewController alloc] init];
personViewController.personViewDelegate = self;
personViewController.displayedPerson = person;
personViewController.allowsAction = YES;
personViewController.navigationItem.title=@"Contact Info";
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:personViewController];
[self presentViewController:navController animated:YES completion:NULL];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.