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

Rotation works in iOS 5 but not in iOS 6 #24

Open
jdandrea opened this issue Oct 16, 2012 · 5 comments
Open

Rotation works in iOS 5 but not in iOS 6 #24

jdandrea opened this issue Oct 16, 2012 · 5 comments

Comments

@jdandrea
Copy link

Tracing through the code now, but I suspect this has to do with new rotation logic in IOS 6 ... ?

I'm crossing my fingers regarding how this will rotate when using a Tab Bar Controller. Three20's photo viewer suffers from a won't-rotate affliction in iOS 6 as well. I've tried a number of things to resolve it, including some along the lines of the comments in issue #16, but none of them have helped so far.

@cliffrowley
Copy link

Any luck with this? I'm having all kinds of iOS6 rotation related oddities in a landscape app. Even though the content all appears to be displayed with the correct dimensions, there's a portion of the view that I can't interact with. In fact it appears that I can only interact with the portrait width's worth of the screen. E.g. 768 pixels.

When I rotate the device 180 degrees, I can see this "dead space" flickering.

I've tried everything I can think of.

@jdandrea
Copy link
Author

Ah-ha! Try assigning the root view controller to window.rootViewController instead of adding that controller's view as a subview of window:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:rootViewController_iPhone];
    window.rootViewController = navController;
} else {
    window.rootViewController = splitViewController;
}

Still trying to figure out why things still don't work on iOS 5 when this is launched from a View Controller in a Nav Controller in a Tab Bar Controller though. (Three20 has the same problem on iOS 5. iOS 6 is fine. Can't move over to Nimbus yet, but eventually.)

@cliffrowley
Copy link

Already doing that, unfortunately it had no effect. I also just realised this issue isn't for Three20 (I followed it from the ticket you referenced) - which is what I am using.

In the meantime, I've reintegrated the iOS5 SDK with my Xcode and I'm building with that instead. Not ideal, but I've spent so much time trying to work out what's going on..

Also moving to Nimbus in an imminent refactor. Can't wait ;-)

@jdandrea
Copy link
Author

Wow, it sounds like we're in the same boat here! No effect, really??? Hmm. That's the only thing I changed in the Enormego code base, and that's what solved it for me.

Of course, they aren't using a tab bar controller either. I currently subclass it and add stuff like this:

- (BOOL)moreViewController:(UIViewController *)vc {
    return (vc == self.moreNavigationController || [vc isKindOfClass:NSClassFromString(@"UIMoreListController")]);
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    UIViewController *vc = self.activeViewController;
    if ([self moreViewController:vc]) {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    return [vc shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}

- (BOOL)shouldAutorotate {
    UIViewController *vc = self.activeViewController;
    if ([self moreViewController:vc] || ![vc respondsToSelector:@selector(shouldAutorotate)]) {
        return NO;
    }
    return [vc shouldAutorotate];
}

- (NSUInteger)supportedInterfaceOrientations {
    UIViewController *vc = self.activeViewController;
    if ([self moreViewController:vc] || ![vc respondsToSelector:@selector(supportedInterfaceOrientations)]) {
        return UIInterfaceOrientationMaskPortrait;
    }
    return [vc supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    UIViewController *vc = self.activeViewController;
    if ([self moreViewController:vc] || ![vc respondsToSelector:@selector(preferredInterfaceOrientationForPresentation)]) {
        return UIInterfaceOrientationPortrait;
    }
    return [vc preferredInterfaceOrientationForPresentation];
}

I've also added a symbolic breakpoint (sometimes enabled) for:

-[UIViewController shouldAutorotateToInterfaceOrientation:]

What I notice is that -shouldAutorotateToInterfaceOrientation: is only called in the tab bar controller subclass for the initially shown VC, now that I'm using the iOS 6 SDK. Verrry interesting.

@gamoz
Copy link

gamoz commented Oct 28, 2012

I had exactly the same problem. My landscape only app had an area that did not accept touch and showed a black bar artifact when rotating. All this is caused by the UIWindow having the wrong dimensions. In my case I set the plist to landscape only and my UIWindow frame was set according to the statusBarOrientation landscape orientation. Make sure that the UIWindow is set with portrait orientation and all will work fine. Needless to say, you also need the setRootViewController tweak.

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

3 participants