如何在ios 7中禁用界面方向更改

如何在ios 7中禁用界面方向更改,ios,objective-c,uiinterfaceorientation,Ios,Objective C,Uiinterfaceorientation,在my.plist文件中启用了接口方向支持。但我只需要在一个viewController中启用横向。在其他ViewController中,我无法禁用横向模式。请告诉我如何在除一个之外的所有ViewController中禁用横向模式。您可以使用 - (BOOL) shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMa

在my.plist文件中启用了接口方向支持。但我只需要在一个viewController中启用横向。在其他ViewController中,我无法禁用横向模式。请告诉我如何在除一个之外的所有ViewController中禁用横向模式。

您可以使用

- (BOOL) shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskPortrait; 
  //return here which orientation you are going to support 

}
你可以用

- (BOOL) shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskPortrait; 
  //return here which orientation you are going to support 

}

我也有同样的问题。无论我将支持的界面方向设置为什么,它始终允许旋转。而且支持的界面定向甚至被称为!不应该叫Autorotate我也有同样的问题。无论我将支持的界面方向设置为什么,它始终允许旋转。而且支持的界面定向甚至被称为!不应该叫AutoRotate。