iOS 8 vs iOS 7 Autorotation
Asked Answered
M

2

6

Here is a simple single view controller app :

    - (void)viewDidLoad
    {
      [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

      self.view.backgroundColor = [UIColor greenColor];
     }


    - (BOOL)shouldAutorotate
    {
       return YES;
    }

    - (NSUInteger)supportedInterfaceOrientations
   {
        return UIInterfaceOrientationMaskLandscapeRight;
   }

The outputs are so different in iOS 8.

iOS 8 output

iOS 7 output

It's got to do with the difference in UIWindow bounds on iOS 8 vs iOS 7. How do I get iOS 7 like behavior ?

Mortmain answered 8/8, 2014 at 15:1 Comment(3)
Is your view controller the root view controller of a window that is the key window?Divergence
Zev, I'm having the exact same problem and I do have a view controller being set as the root view controller. Do you know more about this?Clumsy
Another question like this has already been answered here.Multiflorous
M
0

This appears to be a bug in Xcode 6 or iOS 8. After switching to storyboards from xib, the problem disappeared.

Mortmain answered 17/9, 2014 at 5:17 Comment(0)
S
-1

In IOS8 the list of possible orientations should be in the Info.plist file, the method shouldAutorotate return YES by default.

Take a look on the discussion and documentation below:

https://mcmap.net/q/585105/-how-do-we-dictate-app-orientation-in-ios-8

UIKit Reference: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instm/UIViewController/supportedInterfaceOrientations

When the user changes the device orientation, the system calls this method on the root view controller or the topmost presented view controller that fills the window. If the view controller supports the new orientation, the window and view controller are rotated to the new orientation. This method is only called if the view controller's shouldAutorotate method returns YES.

Override this method to report all of the orientations that the view controller supports. The default values for a view controller's supported interface orientations is set to UIInterfaceOrientationMaskAll for the iPad idiom and UIInterfaceOrientationMaskAllButUpsideDown for the iPhone idiom.

The system intersects the view controller's supported orientations with the app's supported orientations (as determined by the Info.plist file or the app delegate's application:supportedInterfaceOrientationsForWindow: method) to determine whether to rotate.

Sixtynine answered 4/11, 2014 at 16:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.