I have an application that is configured to support Portrait mode only. But I have to show one screen (say abcViewController) in my application in landscape mode. When abcViewController screen is pushed ,orientation changes from Portrait mode to Landscape mode. In that abcViewController screen statusBar, all images ,buttons are shown in landscape mode but UIAlertView is displayed in PortraitMode. This means everything on view changes to landscape mode in abcViewController but UIAlertView doesn’t rotate to Landscape mode and remain in Portrait Mode. I would like the UIAlertView to follow the rules of the containing view controller and show same orientation as statusBar.
Note: I m running my app on iOS 8.0 using Xcode 5.0 and I am searching for the solution which supports Xcode 5.0
Actually, I rotated
UIView
and status bar of this class programmatically for iOS 7 and earlier iOS versions,but I was having this problem of orientation problem in iOS 8, then I read a new change of iOS 8 which is related to orientation which is given below:I ran the following code in both iOS 7 and iOS 8:
The following is the result from iOS 8:
Comparing to the result in iOS 7:
so, I got to know [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8.
After reading this new change of iOS 8 I created a new class for iOS 8, so you have two solutions for this issue.
Solution 1: You should use
UIAlertController
instead ofUIAlertView
.Solution 2: You can create a new class for iOS 8 for which you are facing this orientation issue.