Reputation: 1099
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.
Upvotes: 0
Views: 278
Reputation: 31
Try the following:
[[[UIApplication sharedApplication] keyWindow] setRootViewController:[[TTNavigator navigator] rootViewController]];
Upvotes: 3
Reputation: 1099
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.
Upvotes: 1
Reputation: 3337
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
Upvotes: 1