2011-02-05 44 views
3

在我的cocos2d应用程序中,我的应用程序委托的applicationDidFinishLaunching方法中,通过[director setDeviceOrientation:kCCDeviceOrientationPortrait]设置方向,因为我只是想要肖像。不过,苹果拒绝了我的应用程序说它也必须支持颠倒的肖像。设置正确的cocos2d方向

虽然我不确定我是如何检测到这一点的。阅读当前设备的方向似乎返回一个未知的方向,所以我的问题是双重的:

1)我该如何检测方向,以便我可以正确地将其设置为肖像或颠倒肖像(它将保持良好状态)。

2)我怀疑我会遇到启动画面的问题,因为它在代理中到达此点之前已加载。我如何正确检测方向,以便设置正确的启动画面?

回答

5

我只能修改代码来修复你的第一个问题..我希望你正在使用.99.5 ..

在RootViewController.h

,在功能

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

看看这个行:

#elif GAME_AUTOROTATION == kGameAutorotationUIViewController 
{ 
return (UIInterfaceOrientationIsLandscape(interfaceOrientation)); 
} 

变化

return (UIInterfaceOrientationIsPortrait(interfaceOrientation)); 
+0

其实我使用的是.99.4。但我收集适当的修正是更新到.99.5。不过,我仍然有兴趣了解飞溅方向是否仍然存在问题或有解决方案。也许这只是我在99.4中看到的。 – Joey 2011-02-07 17:18:31