gpt4 book ai didi

iOS ABPersonViewController

转载 作者:行者123 更新时间:2023-11-29 04:58:48 25 4
gpt4 key购买 nike

我有一个选项卡栏应用程序,在第一个选项卡中我有一些按钮和一个表格 View ,其中填充了地址簿中的联系信息。当点击单元格的附件按钮时,我尝试使用 ABPersonViewController 作为模态视图显示联系信息。我可以显示联系信息,但没有取消按钮来关闭模态视图。有人可以看看下面的代码并让我知道我缺少什么吗?

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];
}

最佳答案

根据 docs ,“人物 View Controller 必须与导航 Controller 一起使用才能正常工作。”

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];

关于iOS ABPersonViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7424707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com