Iphone modalviewcontroller的现有VIEWCONTROLLER未旋转

Iphone modalviewcontroller的现有VIEWCONTROLLER未旋转,iphone,ios6,ios7,Iphone,Ios6,Ios7,我从viewController1中演示了ViewController2并旋转了设备,modalviewcontroller ViewController2仅根据旋转旋转,但背景演示视图控制器不旋转 UIViewController *viewController2 = [UIViewController alloc]init]; self.presentationstyle = UIModalPresentationCurrentContext; [self presentViewCo

我从viewController1中演示了ViewController2并旋转了设备,modalviewcontroller ViewController2仅根据旋转旋转,但背景演示视图控制器不旋转

UIViewController *viewController2 = [UIViewController alloc]init];
self.presentationstyle = UIModalPresentationCurrentContext;    
[self presentViewController:viewController2 animated:YES];

请任何人帮助我……

在发布重复问题之前,请先研究一下stackoverflow本身。然而,我将为您提供正确的指示

这是你需要考虑的。 从stackOverflow看这篇文章。
我也有同样的问题,也许我可以为其他人节省一些时间

简单的回答是:我找不到真正的解决办法

答案很长:我认为这是一个错误。令人惊讶的是,在互联网上可以找到的帖子很少,因此可能有一些未知的附带条件触发了这种行为。 它只影响UIModalPresentationCurrentContext。如果您不需要半透明,您可以选择其他模式,如UIModalPresentationFullScreen

结果状态相当混乱:statusBarOrientation报告gui方向正确。界限也改变了。调用setNeedsLayout将导致布局在大小上与实际方向匹配,但方向错误

也许可以通过设置视图的转换或通过添加和删除具有各自方向支持标志的视图来触发框架重新考虑其方向,或其他一些丑陋的解决方法来修复。遗憾的是,无法直接告诉框架更改方向


我求助于使用addSubview而不是presentViewController的解决方案

在不显示模式视图的情况下,viewcontroller屏幕是否随设备方向旋转?为什么不将此帖子标记为重复?