开发者

How can I make a view start in landscape?

开发者 https://www.devze.com 2022-12-24 02:59 出处:网络
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 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:

  1. edit your project's info.plist file
  2. add the UIInterfaceOrientation property
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号