I'm doing this, trying to see in landscape just a gallery, but all I get to show the landscape orientation when I connect the photo gallery modally with the main ViewController as well:
RootViewController -(modal segue)> PhotoGallery
the problem is when I do:
Rootviewcontroler -(modal segue)> ViewControllerModal -(modal segue)> PhotoGallery
it does not work, and neither works with a navigation controller:
RootViewController -(modal segue)> NavigationController A -(push segue)> NavigationController B -(modal segue)> PhotoGallery
I do not know how navigate the hierarchy up to the gallery within supportedInterfaceOrientationsForWindow as well:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
if ([self.window.rootViewController.presentedViewController isKindOfClass: [PhotoGallery class]]){
PhotoGallery *photoGallery = (PhotoGallery *) self.window.rootViewController.presentedViewController;
if (photoGallery.isPresented) return UIInterfaceOrientationMaskLandscape;
else return UIInterfaceOrientationMaskPortrait;
}
return UIInterfaceOrientationMaskPortrait;
}
Thanks in advance.