Setting the correct orientation cocos2d

In my cocos2d application, inside the applicationDidFinishLaunching method for my application delegate, I set the orientation via [director setDeviceOrientation: kCCDeviceOrientationPortrait] because I really need a portrait. However, Apple rejected my application, stating that it should support an inverted portrait.

I'm not sure how I discovered this. Reading the current orientation of the Device seems to return an unknown orientation, so my questions are twofold:

1) How should I determine the orientation so that I can correctly set it to the portrait or portrait at the top (where it will stay forever).

2) I suspect that I will have a problem with the screen saver because it loaded before I get to this point in the delegate. How to determine the orientation so that I can set the correct splash screen?

+3
source share
1 answer

I can only change the codes to fix my first question .. I hope you use .99.5 ..

in RootViewController.h, in function

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

find this line:

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

change to

    return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );
+5
source

Source: https://habr.com/ru/post/1790139/


All Articles