Domanda

I try to get autorotate work in iOS6. I've already read about it and the problem is, that I can't set a rootviewcontroller for the window. I've tried it with:
self.window.rootViewController = [[TTNavigator navigator] rootViewController];
but the App crashes with unrecognized selector...
In iOS5 the autorotation worked fine with the shouldAutorotateToInterfaceOrientation method.

È stato utile?

Soluzione 3

This tutorial worked for me: http://www.goodnewtiger.com/llf/cegeek/?p=61
I had to change the TTNavigationController and set the viewcontroller in the app delegate.

Altri suggerimenti

Try the following:

[[[UIApplication sharedApplication] keyWindow] setRootViewController:[[TTNavigator navigator] rootViewController]];

Autorotation changed with iOS6. Yes in iOS5 you used shouldAutorotateToInterfaceOrientation. You'll still need that to support iOS5, but to support iOS6, drop in the new method below.

I think this is what you're after.

#pragma mark - View Orientation
-(NSUInteger)supportedInterfaceOrientations {
// For iOS6

NSUInteger orientation = 0;

orientation |= UIInterfaceOrientationMaskPortrait;
orientation |= UIInterfaceOrientationMaskPortraitUpsideDown;
orientation |= UIInterfaceOrientationMaskLandscapeLeft;
orientation |= UIInterfaceOrientationMaskLandscapeRight;

return orientation;
}

Then comment out, or remove the lines that you don't want to support. You could return that on one line bitwise 'OR'ing the desired orientations. There are two others available:

UIInterfaceOrientationMaskAll and UIInterfaceOrientationMaskAllButUpsideDown

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top