setting proper cocos2d orientation

久未见 提交于 2019-12-12 13:38:03

问题


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 questions 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?


回答1:


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 ) );


来源:https://stackoverflow.com/questions/4905298/setting-proper-cocos2d-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!