I have a MainViewController which has a button which pushes a new view (InfoViewController), via flip horizontailly. like so:
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
The MainView Controller supports Portrait and PortraitUpsideDown. Like so:
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait |
UIInterfaceOrientationMaskPortraitUpsideDown);
}
In my InfoViewController it also states the above code. In my AppDelegate it has this in the LaunchOptions:
[self.window setRootViewController:self.mainViewController];
In my app.plist file it supports all orientations. This is because other views need to support landscape as well. So On my MainViewController and InfoViewController I need only Portrait and PortraitUpsideDown. But on another view I need all orintations.
My MainViewController works fine, but my InfoViewController is working for all orientations.
I am having extreme diffulty trying to get this to work in iOS6. I have researched other posts and tried the assistance other people have provided, but had no luck whatsoever. Please can someone help me acheive this thank you. And I’m a Objective-C newbie :p
Don´t support all orientations in your app plist file, only those that your root view controller supports.
Autorotation is changing in iOS 6. In iOS 6, the
shouldAutorotateToInterfaceOrientation:method of UIViewController is deprecated. In its place, you should use thesupportedInterfaceOrientationsForWindow:andshouldAutorotatemethods:Modal ViewControllers no longer get rotation calls in iOS 6:
The
willRotateToInterfaceOrientation:duration:,willAnimateRotationToInterfaceOrientation:duration:,anddidRotateFromInterfaceOrientation:methods are no longer called on any view controller that makes a full-screen presentation overitself—for example those that are called with:
presentViewController:animated:completion:.You can let the view controller that presents your modal view controller inform it of rotation.
Also, now you use:
presentViewController:animated:completion:to present the view controller.presentModalViewController:animated:is deprecated which you use in the code.