setDeviceOrientation(kCCDeviceOrientationPortrait); donot work well on iphone

I change my project from 0.8.3 to 0.9.1
But i meet some question.

in AppDelegate.cpp function applicationDidFinishLaunching(), I add below code
pDirector->setDeviceOrientation(kCCDeviceOrientationPortrait);

in 0.8.3, it works well, set all the sprite to Portrait.
but in 0.9.1, only the screen be seted to potrait(the sprites also be displayed in landscape) on iphone(simu)

the screen shoot

device in Portrait
the view in landscape

In v0.8.5, we change to use RootViewController to control the orientation on iOS.
Please install the xcode templates of 0.9.1, then create new project with it. After that, move the sources in YouGame/ios/ folder into your current project. You can refer to HellWorld/ios/RootViewController.mm

And here’s a wiki page about this [[About device orientation]], which is written in Aug.24

I solved it

in RootViewController.mm, function - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

the default code is below
return UIInterfaceOrientationIsLandscape( interfaceOrientation );

I change it to
return UIInterfaceOrientationIsPortrait( interfaceOrientation );
it does not work

when i change it to
return ( interfaceOrientation == UIInterfaceOrientationPortrait );
it works well

Hi,

I also have that problem, and I solved it too.

but this way is little bit weird.

cause when I build my game with “LandscapeLeft” mode in win32,

I need to use “pDirector~~>setDeviceOrientation" code in AppDelegate.cpp.
but in iOS, I have to don’t use "pDirector~~>setDeviceOrientation(kCCDeviceOrientationLandscapeLeft)” code in AppDelegate.cpp.

It make me confuse for use Landscape or Portrait options…

Please check about this.

I think [[About device orientation]] had answer your question.

having same prob on (android + marmalade)
can anybody please help