2

I'm working on an iPhone app. Right now all my view controllers rotate to portrait, landscape left, and landscape right (default behavior for an iPhone app out of the box). What I want is for my app's setup, app-wide, to include support for all interface orientations. How do I make that happen? I have all interface orientations selected at the project level and it's not making any difference. Here's a pic: enter image description here

Now, when I test my app on my iPhone, it refuses to rotate to UIInterfaceOrientationPortraitUpsideDown. Why?

Okay, once we get that figured out, there is a follow up question... I have a single view controller within my app that I only want to support UIInterfaceOrientationPortrait and UIInterfaceOrientationPortraitUpsideDown how can I achieve this? I have the following code in my controller and it doesn't do the trick:

// The following method never gets called (but wanted to
// include this to show that I've tried it).
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

// This method does get called but has no effect. The VC that this method
// belongs to rotates to all interface orientations except for
// UIInterfaceOrientationPortraitUpsideDown which is definitely
// not what I want...
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationPortrait | UIInterfaceOrientationPortraitUpsideDown;
}

// This method never gets called either and therefore has no effect...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}

Note that my app is storyboard based (if that makes any difference). Any help would be much appreciated! Thanks.

John Erck
  • 9,478
  • 8
  • 61
  • 71
  • `UIInterfaceOrientationMaskAll` – Kevin Dec 25 '13 at 17:48
  • @Kevin where should I put `UIInterfaceOrientationMaskAll`? – John Erck Dec 25 '13 at 17:57
  • `supportedInterfaceOrientations` – Kevin Dec 25 '13 at 17:58
  • @Kevin Thx for the suggestion. However, it did not work. I want my entire app to be able to render in upside down portrait mode. When I added your suggestion to a specific controller via `supportedInterfaceOrientations`, that specific controller still did not rotate to upside down portrait. – John Erck Dec 25 '13 at 18:06
  • Answer: [How to get an iOS 7 iPhone app to rotate to all interface orientations][1] [1]: http://stackoverflow.com/questions/12542472/why-iphone-5-doesnt-rotate-to-upsidedown/12758715#12758715 – John Erck Jan 16 '14 at 19:13

1 Answers1

0

By doing what is explained in Landscape Mode ONLY for iPhone or iPad and adding evey interface orientation when doing it, it will support all orientations.

Change your App's Info.plist file:

Add Supported interface orientations row to your App's Info.plist file with all the supported interface orientation's

row's

Add the supported interface orientation's to "Supported Interface Orientations". (Targets -> YourApp -> Supported Interface Orientations -> Landscape Left & Right)

Supported Interface Orientations

Community
  • 1
  • 1
Aleksander Azizi
  • 9,829
  • 9
  • 59
  • 87
  • 2
    I just created a brand new iPhone project in Xcode. Here's my `Info.plist`: UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortraitUpsideDown In app's single view controller, I added: - (BOOL)shouldAutorotateToInterfaceOrientation { return YES; } It still won't rotate to upside down portrait orientation. What am I missing? – John Erck Dec 25 '13 at 22:44