1

在默认的 cocos2d 1.0 beta 模板中,AppDelegate.m 有一些代码:

// AppDelegate.m
// IMPORTANT:
// By default, this template only supports Landscape orientations.
// Edit the RootViewController.m file to edit the supported orientations.

#if GAME_AUTOROTATION == kGameAutorotationUIViewController
    [director setDeviceOrientation: kCCDeviceOrientationPortrait];
#else
    [director setDeviceOrientation: kCCDeviceOrientationLandscapeLeft];
#endif

接下来,在 GameConfig.h 中,我们定义了:

// GameConfig.h
#define kGameAutorotationNone 0
#define kGameAutorotationCCDirector 1
#define kGameAutorotationUIViewController 2
//
// Define here the type of autorotation that you want for your game
#define GAME_AUTOROTATION kGameAutorotationUIViewController

一起,这正在努力产生一个横向设置,根据您持有设备的方式自动旋转到横向左侧或横向右侧。TableViews 也自动旋转(我有几个表放在一些 cocos2d CCScenes 的顶部)。

但是......我昨晚更新到iOS6。以及 XCode 4.5。

我希望不只是我,而是我的应用程序的轮换现在完全被打破了。我正在尝试通过至少一个 tableview 的代码来修复它...更改 GAME_AUTOROTATION 似乎对 tableviews 没有影响,只是 cocos2d CCScenes(在某种程度上是解决方案的一半)。

我可能只是从头开始构建一些东西而不是使用预先编写的代码,这真是令人沮丧!非常感谢,苹果!

4

2 回答 2

1

我的部分解决方案是

#if GAME_AUTOROTATION == kGameAutorotationUIViewController
    //[director setDeviceOrientation:kCCDeviceOrientationPortrait];
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeRight];
#else
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif

你有更好的解决方案吗?

谢谢

于 2012-09-26T17:06:09.197 回答
0

答案是将我的东西升级到 cocos2d 2.0 并删除对不再使用的 RootViewController 的依赖。

navController_ = [[UINavigationController alloc] initWithRootViewController:director_];
navController_.navigationBarHidden = YES;

[window_ setRootViewController:navController_];
于 2012-09-28T08:11:16.163 回答