简体   繁体   English

无法在iOS 6中旋转界面方向问题

[英]Unable to rotate Interface Orientation issue in iOS 6

I have a app which i want to display in portrait mode. 我有一个应用程序,我想以纵向模式显示。 But I only want to show one view in both modes. 但我只想在两种模式下显示一个视图。

I have do this for iOS5 . 我已经为iOS5做了这个。 But in iOS6,i can't able to do this. 但在iOS6中,我无法做到这一点。

I also tried many codes to solved it. 我也尝试了很多代码来解决它。

How can I solve this problem? 我怎么解决这个问题?

apple has changed orientation in ios 6 . 苹果改变了ios 6的方向。

in short use following steps: 简而言之,使用以下步骤:

1) set supported orientations in Targets->Summary... 1)在目标 - >摘要中设置支持的方向...

在此输入图像描述

2)In iOS6.0 shouldAutorotateToInterfaceOrientation Method is deprecated.So,instead of this method we have to use shouldAutorotate Method. 2)在iOS6.0 shouldAutorotateToInterfaceOrientation ,不应该使用shouldAutorotate方法。因此,我们必须使用shouldAutorotate方法代替此方法。

- (BOOL)shouldAutorotate
 {

   return NO;

  }

3) in method supportedInterfaceOrientations we have to set which orientations we want like UIInterfaceOrientationMaskAll if we want all orientations 3)在方法supportedInterfaceOrientations ,如果我们想要所有方向,我们必须设置我们想要的方向,如UIInterfaceOrientationMaskAll

- (NSUInteger)supportedInterfaceOrientations
  {
return  (UIInterfaceOrientationMaskPortrait |     UIInterfaceOrientationMaskPortraitUpsideDown );

 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM