UIViewController自动旋转?
问题描述:
我设置我的UIViewController在应用程序委托self.window.rootViewController。出于某种原因,我需要开放的标志视图模式从像我的根视图控制器:UIViewController自动旋转?
self.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.window.rootViewController presentModalViewController:signViewC animated:NO];
如果我更改注册查看设备的方向,我的根视图控制器不会改变的方向和我签视图后得到不正确的方向驳回。如果我在标志视图中更改方向,是否可以更改根视图方向?
在我的根控制器我说:如果我不旋转模式的看法根视图
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
和自转的作品。
答
首先,你不应该从你的应用程序代表呈现模式。不管你做什么来确定你是否应该提交视图控制器应该在你的主视图控制器中完成。从那里,你应该调用代码呈现模式,就像这样:
[self presentModalViewController:signViewC animated:NO]
这样一来,你的主视图控制器没有被驳回,这只是下推视图栈,仍然应该以旋转的通知作出回应。
试试看,让我知道它是如何结果。
编辑
取出ModalPresentationStyle。这就是你搞砸了。
是的,它有执行 –
你在哪里调用这些行? –
你是什么意思?它在执行.m文件中。它是默认生成的。或者我需要做点别的? –