upSideDown iPhone orientation is not working in iOS 6?
Asked Answered
B

1

5

hope you will be fine and doing your best.

I am getting a problem in upSideDown Orientation in my iOS 6, while I think I am doing everything perfect, but I don't know why it is not working for me. I am sharing my problem with you so to get any solutions.

What I have done so far:

a) In xcode project Summary tab, I have enabled all the 4 orientations.

b) I have added piece of code (written below) in all of my controller classes.

-(BOOL)shouldAutorotate
{
    return YES;
}
-(NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

but still the upSideDown Orientation is not working

Thanks in anticipation.

Beaconsfield answered 5/12, 2012 at 10:19 Comment(0)
B
8

I have found its solution.

We need to make a separate class of UINavigation Controller type. In .m file add the following methods

// Deprecated in iOS6, still needed for iOS5 support.
// ---

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    //    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return YES;
}

// iOS6 support
// ---
- (BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAll;
}

Now assign this newly created class to your Navigation Controller in story board. Also add the .m file of this class in 'Project -> Build Setting -> Compile Sources'. Run the project and it will support and perform all the orientations including upSideDown.

I hope it will help you all.

Regards

Beaconsfield answered 7/12, 2012 at 7:29 Comment(2)
An alternative is to create a category on UINavigationController as done here: https://mcmap.net/q/705359/-upside-down-orientation-not-working-in-ios6-for-uinavigation-view-and-uitabbar-viewDiplopod
I need it only for iPhone with iOS 7 to detect PortraitOrientationUpSideDown.Fassett

© 2022 - 2024 — McMap. All rights reserved.