ABPeoplePickerNavigationController自动关闭而不显示地址簿

时间:2012-11-22 11:24:13

标签: objective-c ios5 uiinterfaceorientation ipad addressbookui

我正在使用ABPeoplePickerNavigationController来选择用户的地址簿联系方式。使用此代码后面的按钮操作:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];

picker.peoplePickerDelegate = self;
picker.view.frame=self.view.frame;
[self presentModalViewController:picker animated:YES];
[picker release];

当此代码运行时,它将Landscape UI旋转为Portrait,并最终解除显示此ABPeoplePickerNavigationController的控制器。

我只在iOS 5,iPad 2中遇到此问题。它适用于iOS 6。

1 个答案:

答案 0 :(得分:0)

我不相信5.x这个选择器支持横向。但是,尝试通过不同的PresentationStyle来做。我相信它应该在风景中起作用,即:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
picker.modalPresentationStyle  = UIModalPresentationFormSheet;
[self presentModalViewController:picker animated:YES];