why iPhone 5 doesn't rotate to upsideDown

后端 未结 5 1902
挽巷
挽巷 2020-12-29 05:18

i added the new methods to my code like described at apples iOS 6 Documentations but on the iPhone 5 the App doesn\'t rotate to upside down. Only the to landscape Ways.

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 06:02

    Forgive the verbosity, but I think your answer is below.

    I was having the same problem, but it was occurring on all IOS 6 devices including my iphone 4. Reading your question actually answered mine. I had removed this ages ago because it wasn't doing anything:

    - (NSUInteger)supportedInterfaceOrientations{    
        NSLog(@">>> Entering %s <<<", __PRETTY_FUNCTION__);
        return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
                UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown); }
    

    and my code was working perfectly in prior ios releases. It appears this has become manditory in ios 6. But only for upsideDown. The other orientations were working fine.

    So, thank you.

    Back to your problem. Have you reviewed your project target to see if all "Supported Interface Orientations" are dark gray? I'm wondering if upside down is light gray, (ie, unchecked). I found in a quick test that on prior ios releases these are ignored too. As long as you return YES from shouldAutorotateToInterfaceOrientation it will support the orientations, but not in iOS 6.

    Lastly, you have implemented shouldAutorotate, which I have not in my code. I think this defaults to Yes. And I think this just tells the os to try to rotate, but then you have to tell it which orientations you support with shouldAutorotateToInterfaceOrientation. But your snippet doesn't show that you've implemented shouldAutorotateToInterfaceOrientation. I would suggest implementing this as it tells the OS which orientations you support returning a simple YES means you support all.

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

    Hope this helps.

提交回复
热议问题