11

I have

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>

in info.plist and did a search and set every instance of shouldAutorotateToInterfaceOrientation to return YES. But on iPhone it behaves as if upsidedown is not supported. UpsideUp portrait works, landscapes work, updsidedown shows landscape. Why?

iPad works fine in all orientations. And they share .xibs


UPDATE

I have since added

- (BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;    
}

after every existing instance of shouldAutorotateToInterfaceOrientation and still no love.

I am targeting iOS 4.3 but my simulator and physical device run iOS 6

Fresheyeball
  • 29,567
  • 20
  • 102
  • 164
  • If you are running iOS 6, rotation support was changed in iOS 6, read the second comment: http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size – Sverrisson Oct 18 '12 at 18:35
  • I am targeting 4.3 but running iOS6 on my device – Fresheyeball Oct 18 '12 at 18:38
  • The second comment from me discusses how to add support for iOS 6 rotation support and still support the old way. – Sverrisson Oct 18 '12 at 18:42
  • @Hannes, do you have an explanation of why the views actually rotate to any orientation but one, not staying in the initial default orientation ? I believe your answer to another question explains the later case while the problem is the former. – A-Live Oct 18 '12 at 18:46
  • @HannesSverrisson I have updated my question attempting the solution you referenced. Still same behavior. – Fresheyeball Oct 18 '12 at 18:47
  • Some system view controllers do not support upside down portrait orientation. If you are displaying one of these modally, you won't be able to change to that orientation. – Beltalowda Oct 18 '12 at 18:52
  • @Fresheyeball The methods need to be in your root view controller. Then, check settings in your -info.plist. – Sverrisson Oct 18 '12 at 18:54
  • @HannesSverrisson all three methods are in all view controllers including root view controller. info.plist was posted in my question. – Fresheyeball Oct 18 '12 at 19:06
  • One thing I've just refreshed at memory is that there were orientation problems with iOs 6 as i added the root viewController's view on the window instead of using `self.window setRootViewController:`, you might want to check it. – A-Live Oct 18 '12 at 19:13
  • @A-Live I was setting the `rootViewController` in the AppDelegate with `self.window.rootViewController = mycontroller`. I just tried doing it the square bracket method way you mentioned. No change. – Fresheyeball Oct 18 '12 at 19:18
  • @Fresheyeball go through this and double check everything: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html#//apple_ref/doc/uid/TP40007457-CH7-SW1 – Sverrisson Oct 18 '12 at 19:24
  • @Fresheyeball Try making a new "Single View Application" project and set the above methods to the root view controller. Allow all orientations in the info.plist. Add a label to the view with text "A". Run it and you should see it support all the orientations. Now use this to compare to your current project and tweak it into working. – Sverrisson Oct 18 '12 at 19:33

2 Answers2

6

Need some more context based on what you've tried already? Are you using a NIB-based setup with a navigation controller, tab bar controller or something like that? If so, you need to add a category to support it because you can't override the implementation of those classes in NIBs (or in general)

https://stackoverflow.com/a/12758715/490180

Talks about iPhone 5, but the issue is really iOS6 related.

Community
  • 1
  • 1
Matt S.
  • 1,882
  • 13
  • 17
  • Still no love. But here is more info: there is a UIViewController being set in the AppDelegate to rootView controller, this UIViewController loads a modal. Thats the entire structure right now. – Fresheyeball Oct 18 '12 at 22:22
  • One alternative to using a category would be to subclass the `UINavigationController` used by the nib and add the implementation to the subclass. – ThomasW Apr 15 '14 at 02:01
  • @ThomasW Only on iOS6+ can you subclass safely. Since the OP was targeting 4.3, the recommendation for Categories is the safe one. – Matt S. Apr 15 '14 at 14:05
-1

It's by design. The reason being the iPhone is a phone and if the UI can be rotated upside down, the user will have problems when a phone call comes in. There is no nice sequence for dealing with an upside down UI. If your app were rotated upside down, the incoming call screen would have to be upside down relative to your app, which would not be a good experience. If it were not, user's would be answering the phone holding the hardware upside down, which would be quite funny, but not in a good way.

TheBasicMind
  • 3,585
  • 1
  • 18
  • 20
  • 3
    You absolutely can have and iPhone app support an upsidedown orientation. And there are plenty of specific and creative reasons to do so that are a boon to UX. Your answer is both factually and philosophically inaccurate as well as unhelpful. – Fresheyeball Oct 18 '12 at 19:28
  • 2
    This is plain wrong! Apple "recommends" is not the same as "can´t be" – Sverrisson Oct 18 '12 at 19:30
  • Your criticism is plain wrong. Please reference the question asked "But on iPhone it behaves as if upsidedown is not supported. UpsideUp portrait works, landscapes work, updsidedown shows landscape. Why?" I have given the answer. Please point out where I have said it can't be done if you want to do it. You are programmers and should be able to parse simple logic. – TheBasicMind Oct 18 '12 at 19:53
  • Please explain why. It is perfectly accurate answer to the question asked. There is a difference of behaviour between iOS on the iPhone and the iPad. The reason this difference is the explanation I have given. There are ways of overriding the recommended behaviour and an answer has already been given if he wishes to do that. Incidentally despite the assertion above there are virtually no helpful usability reasons to do so other than purely creative reasons and doing so for non games apps is likely to result in app store rejection. – TheBasicMind Feb 14 '13 at 15:17
  • I think it's unfair to vote down TheBasicMind just because he explains Apple's reasoning (right or wrong, your choice). But it did help me to understand the reasoning behind Apple's decision. +1. – fbitterlich Nov 03 '14 at 16:10