Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I don't know how to do Portrait and Upside down in iOS 6

I am using:

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait; 

}

How would I use this for Portrait and Upside down in iOS6?

this works for landscape left UIInterfaceOrientationMaskLandscapeLeft

and this for Landscape right UIInterfaceOrientationMaskLandscapeRight

and this for both landscapes UIInterfaceOrientationMaskLandscape

like image 590
OnkaPlonka Avatar asked Dec 16 '12 12:12

OnkaPlonka


People also ask

Where is portrait orientation in iPhone 6 settings?

Swipe down from the top-right corner of your screen to open Control Center. Tap the Portrait Orientation Lock button to make sure that it's off. Turn your iPhone sideways.

Why is my portrait orientation not working?

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.


2 Answers

You need to return a valid bitmask of the orientations you wish to support:

For portrait and portrait upside down:

- (NSUInteger)supportedInterfaceOrientations {

    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);

}

You can see a list of the supported orientation masks

It's important to note also, that you need to list portrait upside down in your supported orientations as well:

enter image description here

like image 155
Abizern Avatar answered Oct 12 '22 10:10

Abizern


You need to use the bitwise OR operator for each supported orientation.

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait |
        UIInterfaceOrientationMaskPortraitUpsideDown; 
}

Add another bitwise OR for each orientation you want to support. Typically, when you see a constant with the word "mask" in it, they are meant to be combined in this way.

like image 26
Mark Avatar answered Oct 12 '22 10:10

Mark