Reputation: 2576
My app is fixed to landscape mode, yet during viewDidLoad() and even viewWillAppear(), the following portrait dimensions still return:
self.view.bounds.size.width = 320.00
self.view.bounds.size.height = 480.00
It's not until viewDidAppear() that the actual landscape dimensions result.
self.view.bounds.size.width = 480.00
self.view.bounds.size.height = 320.00
I find this weird. Why does this happen!? and how can I fix this?
Upvotes: 1
Views: 757
Reputation: 12106
In your app's info.plist file, specify the key:
UISupportedInterfaceOrientations
with values for landscape left and right:
EDIT:
The raw plist code should look like this:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Edit 2
You also need this key which determines the initial orientation of the status bar:
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeRight</string>
Further, you need to make sure that ALL of your view controllers (tabbar, navbar, regular view-controllers) implement
shouldAutorotateToInterfaceOrientation
and return a Landscape (left or right) value.
Here is an Apple docs article on the subject:
And finally, here are some other SO posts on this topic: post 1 and post 2.
Upvotes: 3