3

In my project I check all the types of orientations I need! This works fine on iOS 7.1 but it doesn't work properly for iOS 8.1. In iOS 8.1, when I open the app in portrait or landscape mode it works fine but when in middle of use I rotate my device only the status bar changes the rotation! How can I fix this?

Aryan
  • 2,675
  • 5
  • 24
  • 33
  • Have a look at `supportedInterfaceOrientations()` method – chris13 Oct 23 '14 at 05:13
  • @chris13 I test this function but no improvement! override func supportedInterfaceOrientations() -> Int { return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) } – Aryan Oct 23 '14 at 05:19
  • I'm having this issue when I go to a page that has landscape and portrait orientations. When I go back to a previous page that is only portrait my status bar will still rotate. It is only happening in 8.1. 8.0x works – egfconnor Oct 23 '14 at 15:44
  • I've the same issue after update to Xcode 6.1 and iOS 8.1. – RFG Oct 23 '14 at 19:22
  • Seems to be a bug in 8.1. I'm using objective c in my apps but seeing the exact same issue, none of the rotation methods have any effect. They all work fine in 8.0 though, and in fact all iOS versions prior to 8.1. It's being discussed it on the dev forums too: https://devforums.apple.com/message/1064397#1064397 – ChrisJP Oct 24 '14 at 00:02

4 Answers4

10

I had same issue many days and got answer from ChrisJP's link.

appdelegate.m file, comment the following code in application didFinishLaunchingWithOptions.

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

Here is the text from the link (in case it expires or people don't want to log in to the developer forums):

"I've managed to fix this!

I assume you guys are all using storyboards too? If so, you've probably got some old leftover code in your app delegate from when you weren't using storyboards, turns out this was no longer needed when storyboards are used, but until 8.1 has had no effect.

  1. Make sure your navigation controller (or whatever you're using) is set as "Initial View Controller" in your storyboard

  2. In your appdelegate.m file, remove any references to UIWindow and rootViewController that appear in application didFinishLaunchingWithOptions. For me, I still had the following two lines, which after removing, fixed my issues:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; [self.window makeKeyAndVisible];

and also I was setting self.window.rootViewController. This also does not need to be set unless you're overriding it for some reason.

That's what fixed it for me, hopefully it does for you guys too."

BeccaP
  • 1,452
  • 1
  • 13
  • 19
DanielLin
  • 116
  • 1
  • 4
  • It looks like we must have one storyboard set as Main Interface (project settings) in order to have it create the Window for us – onmyway133 Oct 29 '14 at 07:38
  • This did work for me. I did have to set self.window.rootViewController, however. – BeccaP Dec 11 '14 at 19:11
1

In my case I was creating my storyboard programatically but then still referencing the storyboard in the project settings. Leaving the 'Main Interface' field in the deployment settings blank fixed the problem.

Mark Bridges
  • 8,228
  • 4
  • 50
  • 65
  • Answer above from DanielLin is correct if you use storyboards. But if you customize "didFinishLaunchingWithOptions" in your AppDelegate than this is exactly what you are looking for !! – Jiří Zahálka Mar 12 '15 at 23:51
0

Can you please check you Xcode version ? it may be the problem

iOS 8: Autorotation is not working without storyboard

Community
  • 1
  • 1
DIJO JOSEPH
  • 366
  • 2
  • 18
0

I also had this exact issue when updating to iOS 8.1. If your app does not use a storyboard, it can be solved by removing the reference Main storyboard file base name in the info.plist

or when opened as Source Code

<key>UIMainStoryboardFile</key>
<string>Main</string>
SimonRain
  • 13
  • 2