选择联系人后如何显示模态视图控制器? [英] How can I present a modal view controller after selecting a contact?
问题描述
我试图在选择一个联系人之后呈现一个模态视图控制器,但它似乎不起作用.
I'm trying to present a modal view controller after selecting a contact and it doesnt seem to be working.
在我的-
(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
方法,我关闭了peoplePicker,创建了新的视图控制器的实例,然后用
method, I dismiss peoplePicker, create an instance of my new view controller, then present it with
[self.navigationController presentModalViewController:newController animated:YES];
,它不起作用.但是,如果我按下视图控制器,它将使用以下代码:
and it doesnt work. However if i PUSH the view controller it works with this code:
[self.navigationController pushViewController:newController animated:YES];
我该怎么做?
谢谢
推荐答案
只需在您自己的控制器(而不是导航控制器)上调用presentModalViewController. 如果您位于UIViewController的上下文中: [自己presentModalViewController:newController动画:是];
Simply call the presentModalViewController on your own controller instead of the navigation controller. If you're in the context of a UIViewController: [self presentModalViewController:newController animated:YES];
这篇关于选择联系人后如何显示模态视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!