UIAlertView won't rotate to landscape even with applicationDidFinishLaunching call
I am trying to use UIAlertView on my landscape right (hom开发者_StackOverflow中文版e button on the right) app but it is showing up in portrait orientation. I have tried putting:
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ];
in applicationDidFinishLaunching, but it doesn't work. Are there any other usual suspects to what might be causing this? I am setting the orientation through my plist file currently.
Here wherever you launching the application and the method applicationDidFinishLaunching calls it will basically consider in the Portrait mode. But here you can force to be in landscape mode. But the problem with UIAlertView is that it must have one base view so you need to call UIAlertView method in the View Controller instead of in applicationDidFinishLaunching method.
So, Please make your object for UIAlertView in the ViewController from where your application starts. And it will work in both Landscape as well as in the Portrait mode. I had the same issue and I solved it using the same method as I described here. Let me know if you need more help.
精彩评论