I have read a few questions about an app doing it through the info file but not a certain view.
I just need the interface to be set up to start in landscape view.
I managed to get near what I want with shouldAutoRotateToInterfaceOrientation:, but it only works after I rotate the view.
I am kinda new to the documentation on this so I may be looking in the wrong places f开发者_如何学Pythonor this.
Any help is appreciated.
If I understand your question correctly, you need to:
- edit your project's info.plist file
- add the UIInterfaceOrientation property
- choose as its value one of {UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight}
This is theoretical, but assuming that you have code in your shouldAutoRotateToInterfaceOrientation
method that will adjust the view for display in the given interface orientation, in your viewDidLoad
method, try calling your shouldAutoRotateToInterfaceOrientation
method with either UIInterfaceOrientationLandscapeLeft
or UIInterfaceOrientationLandscapeRight
.
You say that it only works when the device is rotated, so manually calling that method as soon as the view has loaded should do the trick.
精彩评论