Joe*_*oey 3 launch orientation cocos2d-iphone
在我的cocos2d应用程序中,在我的app委托的applicationDidFinishLaunching方法中,我通过[director setDeviceOrientation:kCCDeviceOrientationPortrait]设置方向因为我真的只想要肖像.但是,Apple拒绝了我的应用程序,说它必须支持颠倒的肖像.
不过,我不确定我是怎么发现这一点的.阅读当前的设备方向似乎返回一个未知的方向,所以我的问题是双重的:
1)我应该如何检测方向,以便我可以正确地将其设置为纵向或倒置的肖像(它将保持良好状态).
2)我怀疑我的启动画面会出现问题,因为它是在我到达委托中的这一点之前加载的.如何正确检测方向,以便设置正确的闪屏?
我只能编辑代码来修复你的第一个问题..我希望你使用.99.5 ..
在RootViewController.h中,在函数中
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
寻找这一行:
#elif GAME_AUTOROTATION == kGameAutorotationUIViewController
{
return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );
}
Run Code Online (Sandbox Code Playgroud)
改成
return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );
Run Code Online (Sandbox Code Playgroud)