2
votes

I am trying to use UIAlertView on my landscape right (home 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.

1

1 Answers

0
votes

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.