【问题标题】:Why is the orientation wrong at app start?为什么应用程序启动时方向错误?
【发布时间】:2013-11-12 12:06:35
【问题描述】:

我正在开发一个同时支持纵向和横向方向的 iPhone 应用程序。当我在横向模式下启动应用程序并验证 AppDelegate 中的方向时,它会返回纵向方向。旋转设备/模拟器后,它会正确返回方向。这是一个 iOS 7 应用程序。有谁知道如何处理这个?我需要知道启动时的方向以处理 UI。

【问题讨论】:

  • 如果您想在这里获得建议,您需要发布您使用的代码。还要记录您的轮换和发布。如果人们要建议你向他们展示你已经完成了,你是如何做到的

标签: ios ios7 uiinterfaceorientation


【解决方案1】:

UIViewController 文档说:

Note: At launch time, apps should always set up their interface in a portrait orientation. After the application:didFinishLaunchingWithOptions: method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window.

这就是它首先返回纵向模式的原因。更多信息在UIViewController documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-09
    • 2018-10-06
    • 2021-07-10
    • 2010-09-12
    • 1970-01-01
    • 2015-09-20
    • 2012-07-11
    • 2013-10-17
    相关资源
    最近更新 更多