Multiple UIInterfaceOrientations app with iOS 6
Asked Answered
U

2

3

I'm having a bad time trying to set the new UIInterfaceOrientations from iOS 6.

Resuming my app:

  • My app have a bunch of views;
  • Almost every view should be shown on Portrait orientation;
  • 2 of my views (the ones that play videos with MPMoviePlayerViewController) should rotate to left, right and portrait orientations.

My original idea was to set the app supported orientation to Portrait and than change (don't know how) the supported orientation from the video player views.

What would be the best way to deal with this?

Thank you in advance!

Untitled answered 26/9, 2012 at 20:46 Comment(3)
Hi, what would be the actual problem you are experiencing? Did you try implementing the: supportedInterfaceOrientations method in your ViewController? There is more info about the basics of device orientations in the docs: developer.apple.com/library/ios/#featuredarticles/…Interloper
Thanks @Interloper I think I wasn't very clear on my question but I was able to solve my problem last night. The return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft; that were on your link really helped me to figure out how the orientations worksUntitled
I had the same problem and none of the hundreds of answers on SO worked or me. I finally figured it out and posted how I fixed it: #12630859Forster
U
2

The problem was solved using by setting the Supported Interface Orientations to all I need (Portrait, Landscape right and left) and adding one Category of UINavigationController.

I added the Category to any occurrence of UINavigationController that I want to stay on Portrait mode and treated the iOS 6 rotation like this post:

@implementation UINavigationController (Rotation_IOS6)

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

@end

With this implemented I still have some problems because the code was like this:

[self.window.rootViewController presentModalViewController:controller animated:NO]; 

instead of this:

[self.navigationController pushViewController:controller animated:NO];

With the above changes I was able to keep the entire app on Portrait Mode and let the video player views to keep rotating because their methods (shouldRotate and supportedInterfaceOrientations) weren't overridden.

Untitled answered 27/9, 2012 at 18:40 Comment(0)
M
1

Check out my post: https://mcmap.net/q/487846/-autorotate-in-ios-6-has-strange-behaviour It's the same thing but flipped orientations for you.

Medicable answered 26/9, 2012 at 20:56 Comment(1)
Thank you @rocky, that really helped, I was able to understand a little bit more about the changes of iOS 6 on screen rotation. But it unfortunately didn't solve my problem.Untitled

© 2022 - 2024 — McMap. All rights reserved.