且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

这是iOS 8错误(旋转方向问题)吗?

更新时间:2023-02-02 14:28:25

也有类似的问题.令人惊讶的是,解决方法是注释掉与Appdelegate上与self.window相关的所有代码.

Had similar problem. Surprisingly the fix was to comment out all the code related to self.window on Appdelegate.

评论了self.window及其赋值的初始化.通过选中是初始视图控制器"复选框,在属性"检查器的情节提要中设置初始视图.

Commented initialising of self.window and its assignment. Set the initial view in storyboard in Attributes inspector by checking "Is Initial View Controller" checkbox.

更好的新解决方案
评论self.window引起了其他问题.相反,下面的代码是***的:

New Better Solution
Commenting self.window was causing other issues. Instead the below code is best:

- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification 
    {
         [UIViewController attemptRotationToDeviceOrientation];
    }