Question

If i build my app on my iPad it seems to be in portrait mode and device orientation changes do not affect it. I know it is very early but it is very important as I have to finish the app soon. Does anybody know a fix for this ?

Was it helpful?

Solution

Okay there is a fix that I came across in the cocos2d forums

Just go into your app delegate and change this line of code:

// set the Navigation Controller as the root view controller
[window addSubview:viewController.view];

to this:

// set the Navigation Controller as the root view controller
[window setRootViewController: viewController];

OTHER TIPS

I think your using cocos2d-v-1.0 version. Try in new cocos2d version(cocos2d-v2.0), it will work fine.

In appdelegate.m

navController_ = [[UINavigationController alloc] initWithRootViewController:director_];
    navController_.navigationBarHidden = YES;
[window_ setRootViewController:navController_];

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

In my case it working fine, Once check this.

I tried the @user1066899 method with no success. I did however, fix this by removing the "shouldAutorotateToInterfaceOrientation" delegate method completely and set the supported orientations of landscape in the build settings under "summary".

The plist is not being set by the summary. Usually you can set the settings in the summary.

This should let you set the orientation in the target summary for both devices:

  1. click the blue icon

  2. click the dual pencil and ruler icon

  3. click summary

  4. click the applicable Supported Inter face Orientations

But this interface is bugged. The settings don't correctly change from this screen.

You have to manually set the plist.

  1. find the NAME-Info.plist in Supporting Files in the project navigator

  2. Initial interface orientation

  3. set Supported interface orientations (iPad)

  4. set Supported interface orientations (iPhone)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top