iOS 8.1 auto rotation

2019-02-15 04:15发布

In my project I check all the types of orientation I need!

orientations

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?

标签: ios swift xcode6
4条回答
祖国的老花朵
2楼-- · 2019-02-15 04:39

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>
查看更多
家丑人穷心不美
3楼-- · 2019-02-15 04:40

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

iOS 8: Autorotation is not working without storyboard

查看更多
混吃等死
4楼-- · 2019-02-15 04:50

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.

查看更多
爷的心禁止访问
5楼-- · 2019-02-15 04:52

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."

查看更多
登录 后发表回答