Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 6 autorotation problem #33

Open
macstens opened this issue Sep 25, 2012 · 10 comments
Open

iOS 6 autorotation problem #33

macstens opened this issue Sep 25, 2012 · 10 comments

Comments

@macstens
Copy link

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?

@ccraigc
Copy link

ccraigc commented Oct 9, 2012

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.

@bagusflyer
Copy link

I got the same issue. Any solution for iOS 6?

@ccraigc
Copy link

ccraigc commented Oct 20, 2012

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.

@bagusflyer
Copy link

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.

@ccraigc
Copy link

ccraigc commented Oct 20, 2012

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.

@shem8
Copy link

shem8 commented Oct 29, 2012

Can you please explain a little bit more on how to fix this issue?
Thanks.

@HDdeveloper
Copy link

Solved
For iOS 6 use:

  • (BOOL) shouldAutorotate
    {
    return YES;
    }

and in appDelegate change

// [self.window addSubview:navigationController.view];
to
[self.window setRootViewController:navigationController];

@a1phanumeric
Copy link

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.

@Miguel86
Copy link

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.

@rptwsthi
Copy link

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
![Uploading IMG_1417.PNG…](looks like this) 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.
img_1418

Did it occur to someone else. How can it be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants