0

该应用程序仅设置为横向。

在 Project->target->Summary->Supported Interface Orientations 中,我启用了 2 个横向图标(左侧和右侧)。

在 AppDelegate.m 中,编写了以下代码:

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

应用在设备上运行时,视图显示在默认cocos2d图标之后的开头,所有位置都错了,都移到了右下侧。当我旋转屏幕时,一切正常,都在正确的位置。

怎么了?

我还尝试了以下方法:我禁用了 In Project->target->Summary->Supported Interface Orientations 中的所有图标。AppDelegate 中的代码仍在使用中。然后一开始的视图还可以,但是屏幕可以旋转到纵向。

……

任何人都可以帮忙吗?

4

1 回答 1

1

还将这两个用于 iOS6 方向,在 AppDelegate 中。

-(NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskLandscape;
}

- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    return UIInterfaceOrientationMaskLandscape;
}

看这个问题并回答一次。

于 2013-04-09T03:49:40.367 回答