【问题标题】:Launching navigation controller in landscape?在横向启动导航控制器?
【发布时间】:2010-08-06 18:07:45
【问题描述】:

我正在尝试制作一个使用导航控制器的横向应用程序,但我无法让该应用程序以横向模式启动。一旦我在另一个视图中并使用 [self.navigation popToRootViewControllerAnimated:YES];那么根视图是横向的。为什么在应用启动时它不是横向的。

我已经在 Interface Builder 中将其置于横向模式,并且我已经实现了以下代码。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);


}

谁能给我解释一下。我应该在 appdelegate 中做些什么吗?

【问题讨论】:

    标签: iphone xcode sdk controller navigation


    【解决方案1】:

    请参阅Info.plist key reference。特别是,设置任一

    • <key>UIInterfaceOrientation</key> <string>UIInterfaceOrientationLandscapeRight</string>
    • <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeLeft</string> </array>

    第二个允许您的应用以两个方向启动,但仅在 OS 3.2+ 上受支持,因此您可能也希望包含第一个。对于纯横向应用,“LandscapeRight”似乎比“LandscapeLeft”更常见。

    【讨论】:

      【解决方案2】:

      尝试在应用程序的 plist 中添加键值对“支持的界面方向”。

      【讨论】:

        猜你喜欢
        • 2011-06-18
        • 2012-03-07
        • 1970-01-01
        • 2012-12-04
        • 1970-01-01
        • 1970-01-01
        • 2011-04-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多