FGallery-iPhone
FGallery-iPhone copied to clipboard
iOS 6 autorotation problem
In
FGalleryViewController.m
- (BOOL) shouldAutorotateToInterfaceOrientation
the autorotation-methods for its parent controller have been overridden, which has worked wonderful until the recent release of iOS6.
Unfortunately, the images can no longer be rotated when the supported rotations have been set to, for example, only portrait. It seems like the method does not override this behavior anymore.
Did someone came up with a solution for this?
autorotation is posing a problem for me, as well. I'd love to get more clarity on the topic.
To add to your comment... The supported interface orientations in the plist appears to be subtractive, so you'd want to include all that your app uses. Then, in your app delegate, override application:supportedInterfaceOrientationsForWindow: to provide a default bitmask for child views of the UIWindow passed in. Finally, your view controllers should provide their own, specific bitmasks, as necessary, using the selector supportedInterfaceOrientations.
The issue I'm currently facing is the container view controllers such as UINavigationController and my own implementation of ViewDeck controller. Parent controllers take precedence and the hierarchy's orientation handling isn't 100% clear.
I got the same issue. Any solution for iOS 6?
Yes, the solution that I decided upon, and which others have mentioned, is to presentViewController with your gallery view rather than push to your navigationController. Then you can use the shouldAutorotate and supportedInterfaceOrientations within the presented controller to set the supported orientations. Your whole hierarchy has to agree if you push to navigationControllers.
Thanks. I think this is not a perfect solution but I can use it for the time being and I'll continue to investigate the problem and let you know if I find a "perfect" solution.
在 2012年10月20日,上午10:02,ccraigc [email protected] 写道:
Yes, the solution that I decided upon, and which others have mentioned, is to presentViewController with your gallery view tater than push to your navigationController. Then you can use the shouldAutorotate and supportedInterfaceOrientations within the presented controller to set the supported orientations. Your whole hierarchy has to agree if you push to navigationControllers.
— Reply to this email directly or view it on GitHub.
I know what you mean. To explain a little further, you can accomplish what you're after by subclassing UINavigationController and overriding those methods I mentioned by returning their visibleController's supported orientations. Problem I ran into then was forcibly rotating back when popping or pushing other viewsControllers. It seems to disregard those settings until a rotation change is received. If you can figure out the rest I'd be interested in the solution.
Can you please explain a little bit more on how to fix this issue? Thanks.
Solved For iOS 6 use:
- (BOOL) shouldAutorotate { return YES; }
and in appDelegate change
// [self.window addSubview:navigationController.view]; to [self.window setRootViewController:navigationController];
Hey guys, I have a solution if you have a UITabBarController with UINavigationController sub views. The trick is to subclass UITabBarController, then set your UITabBarController to use this class. Inside this subclass, add:
- (BOOL)shouldAutorotate{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
if([self.selectedViewController isKindOfClass:[UINavigationController class]]){
UINavigationController *navController = (UINavigationController *)self.selectedViewController;
if([navController.visibleViewController isKindOfClass:[FGalleryViewController class]]){
return UIInterfaceOrientationMaskAll;
}
}
return UIInterfaceOrientationMaskPortrait;
}
This will ensure that none of your views can rotate, except the FGalleryViewController.
a1phanumeric your solution works but when you are in portrait mode on the gallery and come back to the previous viewcontroller (the one that pushed the FGalleryViewController) the view appears on portrait mode and all content is on the wrong place, is there a way that when you push the back button on the FGalleryViewController the content is displayed correct?
Thanks.
I have this weird issue in iOS 8.3. It works fine in portrait mode and then I rotate to landscape for first time. But When tap once (to got to full screen) in landscape it
 goes to top this corner with portrait frame setting. And then again when I rotate it to portrait, it goes back to bottom with landscape frame setting.
Did it occur to someone else. How can it be fixed.