Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upSideDown iPhone orientation is not working in iOS 6?

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.

like image 577
iOmi Avatar asked Dec 05 '12 10:12

iOmi


People also ask

How do I fix portrait orientation on iPhone 6?

Older iOS Versions – How to Turn Off iPhone 6 Portrait Lock Step 1: Swipe up from the bottom of your iPhone screen. Step 2: Tap the circular lock icon at the top-right corner of this gray menu. Portrait orientation lock is turned off when that button is gray.

Why is my iPhones screen not rotating?

Swipe up from the bottom edge of your screen to open Contol Center. Tap the Portrait Orientation Lock button to make sure that it's off. That's it. Your iPhone or iPod Touch should rotate properly now.

Why won't my phone rotate upside down?

Turn on Auto rotate. You'll find this setting in the Quick Settings menu. If you see Auto rotate highlighted in blue, then auto rotate is turned on. If you don't see Auto rotate, but there's a Portrait icon instead, auto rotate is disabled.


1 Answers

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

like image 160
iOmi Avatar answered Sep 18 '22 01:09

iOmi