PDA

View Full Version : Auto Rotation in iOS 6




LastLine
Sep 13, 2012, 05:16 AM
Hey guys,

I've been using this

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

return UIInterfaceOrientationIsLandscape(interfaceOrientation);

[self prepareTapView];





// return NO;

}

For the longest time to force a landscape orientation.

Under the new iOS SDK it doesn't work and just sits in portrait - frustrating at best, crippling at worst. Can anyone suggest how I change this to fit the new guidelines? I've ben having real trouble with it.

I've looked at the update notes but can't figure out what to do. Anyone able to help?



xStep
Sep 14, 2012, 12:57 PM
I'm still looking closer at this one. Oddly, the simulator doesn't rotate with the 'old' code, but an iPad does.

The trick seems to be the method used to set the root view controller for the apps window. A newer method needs to be used. Something like the following.


[appDelegate.window setRootViewController: myVC];



You _might_ have to do the following in some view controllers. I'm not sure it is required because, well long story and I'm still investing.


- (BOOL)shouldAutorotate
{
return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll; // use what is appropriate for you.
}