开发者

setting proper cocos2d orientation

开发者 https://www.devze.com 2023-02-09 05:12 出处:网络
In my cocos2d application, inside the applicationDidFinishLaunching method for my app delegate, I set the orientation via [director setDeviceOrientation:kCCDeviceOrientationPortrait] because I really

In my cocos2d application, inside the applicationDidFinishLaunching method for my app delegate, I set the orientation via [director setDeviceOrientation:kCCDeviceOrientationPortrait] because I really only want portrait. However, Apple rejected my app saying it must support upside down portrait as well.

I'm not certain how I detect this, though. Reading the currentDevice orientation seems to return an unknown orientation, so my question开发者_如何学JAVAs are twofold:

1) How am I supposed to detect the orientation so I can properly set it to either portrait or upsidedown portrait (where it will stay for good).

2) I suspect I'll have an issue with the splash screen because it's loaded before I reach this point in the delegate. How can I properly detect the orientation so I can set the right splash screen?


I can only edit the codes to fix your first question.. i hope you are using .99.5..

in RootViewController.h, in the function

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

look for this line:

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

change to

    return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );
0

精彩评论

暂无评论...
验证码 换一张
取 消