Joey
Joey

Reputation: 7527

setting proper cocos2d orientation

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?

Upvotes: 3

Views: 3286

Answers (1)

xuanweng
xuanweng

Reputation: 1939

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

Upvotes: 5

Related Questions