如何让视图以横向模式开始?
我已经阅读了一些有关应用程序通过信息文件执行此操作的问题,但没有阅读特定视图。
我只需要设置界面以在横向视图中启动。
我设法通过 shouldAutoRotateToInterfaceOrientation: 接近我想要的效果,但它只有在旋转视图后才起作用。
我对这方面的文档有点陌生,所以我可能在错误的地方寻找这个。
任何帮助表示赞赏。
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 for this.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解您的问题,您需要:
If I understand your question correctly, you need to:
这是理论上的,但假设您的
shouldAutoRotateToInterfaceOrientation
方法中有代码可以调整视图以在给定的界面方向上显示,则在viewDidLoad
方法中,尝试调用您的 < code>shouldAutoRotateToInterfaceOrientation 方法,使用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 yourviewDidLoad
method, try calling yourshouldAutoRotateToInterfaceOrientation
method with eitherUIInterfaceOrientationLandscapeLeft
orUIInterfaceOrientationLandscapeRight
.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.