我已重写我的UINavigationController实现这些方法:iOS 6的旋转不工作
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
从我的第一视图
现在,我模态呈现这个MSNavigationPaneViewController here这就好比一个Facebook侧滑动标签栏控制器。
我需要在此处显示的我的视图控制器中的1个显示仅在应用视图的其余部分仅为纵向时显示横向。
所以我所有的其他视图控制器我已经加入:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
return UIInterfaceOrientationMaskPortrait;
}
和我想景观一个我已经添加了:
- (BOOL)shouldAutorotate
{
return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
但是我所有的意见旋转。
如果我在这些其他视图上将shouldRotate
更改为NO,那么它们将停留在Portrait中,并且我想成为Landscape的视图可以旋转,但是我无法让它自行旋转。 此外,如果我回到另一个具有shouldRotate = NO;
的视图,一旦旋转,则无法将其旋转回肖像。
我已经在这个几个小时了,不能得到它的工作。
感谢
编辑-----
我有这一半现在的工作,并已开始了新的问题,以获得自动旋转工作here
嗯......你的“shouldAutorotate”方法不返回'BOOL's ... –