【问题标题】:After dismissing VC on an upside-down portrait mode the main VC shows up as a normal portrait在倒置肖像模式下关闭 VC 后,主 VC 显示为正常肖像
【发布时间】:2014-07-03 17:55:06
【问题描述】:
假设我有一个在 iPad 上显示的视图控制器:
[self presentViewController:self.someViewController animated:YES completion:nil];
然后像这样解雇:
[self.someViewController dismissViewControllerAnimated:YES completion:nil];
当我以倒置纵向模式打开应用程序时,它看起来不错,然后显示也支持倒置纵向的 VC,然后当我关闭它时,主 VC 将方向更改为正常纵向模式。为什么会这样?我应该在哪里设置它以使其自动调整?
【问题讨论】:
标签:
ios
objective-c
ipad
uiviewcontroller
rotation
【解决方案1】:
看起来有 UIInterfaceOrientationPortrait 由 preferredInterfaceOrientationForPresentation 返回,我将其修复如下:
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//changed this:
// return UIInterfaceOrientationPortrait;
//to this:
return [UIApplication sharedApplication].statusBarOrientation;
}
看起来是不是一个合理的解决方案?