在现有 UINavigationController 中显示 ABPeoplePickerNavigatorController

发布于 2024-09-08 08:21:13 字数 587 浏览 5 评论 0原文

我有一个应用程序,其中的弹出窗口中有一个 UINavigationController ,用于显示一些信息。根项目包含一个显示相关联系人的按钮。我想按下联系人按钮并显示 ABPeoplePickerNavigationController。我有这样的代码来做到这一点:

ABPeoplePickerNavigationController *contactController = [[ABPeoplePickerNavigationController alloc] init];
[self.navigationController pushViewController:contactController animated:YES];

但是,当我按下按钮时,我收到此错误:不支持按下导航控制器

那么:有没有办法访问 ABPeoplePickerNavigationController 中的视图(使用 topViewControllervisibleViewController 都给出错误),或者其他方法这样做将不胜感激。

I have an app where I've a UINavigationController in a popover that displays some information. The root item contains a button showing a related Contact. I'd like to press the contact button and display the ABPeoplePickerNavigationController. I've got this code to do it:

ABPeoplePickerNavigationController *contactController = [[ABPeoplePickerNavigationController alloc] init];
[self.navigationController pushViewController:contactController animated:YES];

When I push the button, however, I get this error: Pushing a navigation controller is not supported.

So: is there a way to either access the views within the ABPeoplePickerNavigationController (using topViewController or visibleViewController both give an error), or an alternate way to do this would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小镇女孩 2024-09-15 08:21:13

使用它来显示导航控制器。您面临的问题是,您只能在控制器中推送视图,而不能推送整个导航控制器:

ABPeoplePickerNavigationController *controller = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controll
controller.peoplePickerDelegate = self;


NSArray *properties = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],nil];
controller.displayedProperties = properties;

// showing the picker
[self presentModalViewController:controller animated:YES];

您可以使用属性部分,也可以不使用。你还必须实现委托协议。

Use this to show the NavigationController. The problem for you is that you can only push a view in your controller and not a whole navigationController:

ABPeoplePickerNavigationController *controller = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controll
controller.peoplePickerDelegate = self;


NSArray *properties = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],nil];
controller.displayedProperties = properties;

// showing the picker
[self presentModalViewController:controller animated:YES];

U can use the properties part or not. U also have to implement the Delegate protocol.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文