I have an application that always displays in portrait mode.
But somewhere, I have a media gallery that should support the landscape.
The supported default orientation in the project is portrait. Because of this, the gallery is displayed only in portrait mode.
If I change the project settings to show in portrait and landscape orientation, the gallery works fine, but I can not control other viewControllers so that they are displayed only in portrait.
I tried several methods like shouldAutoRotate, but no one worked.
Any idea how to solve?
Hello
EDIT:
Solved :)
First, I set up the project to support all orientation. Then I added this method to AppDelegate.m:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape; }
After that, I did to block the orientation in each view controller, less than the one I want to have orientation in landscape and portrait.
Orientation Lock Code (iOS 7):
- (BOOL)shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations { return (UIInterfaceOrientationMaskPortrait); }
Thanks to everyone who answered me :)
source share