【发布时间】:2013-08-29 10:17:40
【问题描述】:
我的 iPad 应用程序有一个名为 MainViewController 的 UIViewController,它显示了一个名为 ModalViewController 的模态页面表 UIViewController。 ModalViewController 然后显示UIImagePickerController。
这里是 MainViewController.m:
@implementation MainViewController {
...
- (BOOL)shouldAutorotate
{
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
...
}
所以它会旋转到任一横向方向,当出现ModalViewController 时,它也会正确旋转。
但是,当 UIImagePickerController 出现时,它允许旋转到横向或纵向,这允许 MainViewController 和 ModalViewController 旋转到不需要的方向。
当UIImagePickerController 出现在屏幕上时,如何防止MainViewController 和ModalViewController 旋转?
【问题讨论】:
标签: ios ios6 uiviewcontroller uiimagepickercontroller