iOS 6控制UIImagePickerController后面的视图控制器的自动旋转

时间:2013-08-29 10:17:40

标签: ios ios6 uiviewcontroller uiimagepickercontroller

我的iPad应用程序有一个名为UIViewController的{​​{1}},其中显示了一个名为MainViewController的模态页面UIViewControllerModalViewController然后会出现ModalViewController

这是 MainViewController.m

UIImagePickerController

因此它会旋转到横向方向中的任何一个,并且当呈现@implementation MainViewController { ... - (BOOL)shouldAutorotate { return YES; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return UIInterfaceOrientationIsLandscape(toInterfaceOrientation); } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeRight; } ... } 时,它也会正确旋转。

然而,当呈现ModalViewController时,它允许旋转到横向或纵向方向,这允许UIImagePickerControllerMainViewController旋转到不希望的方向。

ModalViewController出现在屏幕上时,如何防止MainViewControllerModalViewController轮换?

1 个答案:

答案 0 :(得分:0)

这是Stop a modal UIViewController from rotating问的问题吗?如果你最后使用UINavigationController,你可以将它子类化并控制旋转机制