相关疑难解决方法(0)

iphone:在导航时强制改变从纵向到横向的方向

我们有什么方法可以在导航时强制将应用方向从纵向更改为横向?

我要求将控制器从A推到B.B应该是横向的,但我的A控制器是纵向的.

iphone landscape objective-c orientation uinavigationcontroller

3
推荐指数
1
解决办法
5275
查看次数

iOS 6轮换无法正常工作

我已经覆盖了我的UINavigationController来实现这些方法:

-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
Run Code Online (Sandbox Code Playgroud)

现在从我的第一个视图,我在这里模态地呈现这个MSNavigationPaneViewController ,就像一个Facebook侧滑动标签栏控制器.

我需要在此处显示的1个视图控制器才能显示横向,而应用程序视图的其余部分仅为纵向.

所以在我的所有其他View控制器中,我添加了:

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
    return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)

在我想要的景观中我添加了:

- (BOOL)shouldAutorotate
{
    return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}
Run Code Online (Sandbox Code Playgroud)

然而我的所有观点都在旋转

如果我shouldRotate在这些其他视图上更改为NO,那么它们将保留在Portrait中,并且我想要成为Landscape的视图可以旋转,但是我无法让它自行旋转.此外,一旦旋转,如果我回到另一个视图,shouldRotate = NO;然后它不能旋转回肖像.

我已经在这几个小时了,无法让它工作.

谢谢

编辑-----

我现在正在这一半工作,并开始一个新问题,让自动旋转在这里工作

iphone cocoa-touch uiinterfaceorientation ios

1
推荐指数
1
解决办法
1830
查看次数