ios 6方向

时间:2013-02-28 07:23:10

标签: iphone ios ios5 ios6

  -(NSUInteger)supportedInterfaceOrientations
   {           
     return UIInterfaceOrientationMaskPortrait;
   }

-(BOOL)shouldAutorotate
  {
         return NO;
  }

我只想在我的应用程序的一个视图中启用landascape方向。其他视图必须仅支持纵向模式。但对于iOS 6,它的自动旋转甚至我使用iOS 6的最新方法。期待正确的建议。

1 个答案:

答案 0 :(得分:0)

对于仅限纵向方向,请尝试以下方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

- (BOOL)shouldAutorotate {
    return FALSE;
}