Status bar is Landscape, but [[UIApplication sharedApplication] statusBarOrientation] returns portrait

前端 未结 5 2169
粉色の甜心
粉色の甜心 2020-12-13 05:19

This problem appears to be intermittent, but I am not sure why exactly. When running my application on the device (iPad), I have some code to load a scroll view with some im

5条回答
  •  既然无缘
    2020-12-13 05:29

    Just in case somebody else runs into this, I see a lot of apps that have similar issues in iOS5, actually on iPhone.

    It might be a bug in iOS 5 or just an interference with a common behavior...

    I use a custom root view controller class (a UITabBarController subclass, no idea whether that matters) and in that class I've overridden "shouldAutorotateToInterfaceOrientation" to only start rotating after my initial screen setup is done (doing otherwise messed some things up).

    What I do now is I re-use this class to also set the statusBarOrientation manually to portrait before I allow rotations and to whatever the UI rotates to afterwards.

    [[UIApplication sharedApplication] setStatusBarOrientation:toInterfaceOrientation animated:YES];
    

    I believe this could fix THIS issue, too, even if the cause might be unrelated.

提交回复
热议问题