【问题标题】:For the first time app is in portrait mode,if the device is in landscape mode应用程序第一次处于纵向模式,如果设备处于横向模式
【发布时间】:2012-05-02 05:27:17
【问题描述】:

在我们的应用中,我们的应用首次处于纵向模式。 如果设备处于横向,它将显示纵向屏幕模式。为什么? 但是当我手动旋转模拟器时,它将正确进入横向和纵向模式。 但模拟器第一次显示纵向屏幕.. 请解决我的问题,为什么会发生这种情况或如何解决它..

【问题讨论】:

  • “请解决我的麻烦,为什么会发生这种情况或如何解决它。”当然是伙计。

标签: ios xcode ipad ios-simulator


【解决方案1】:

您必须在 Xcode 中为您的应用添加支持的方向。

如果这不起作用,请尝试将其添加到您的 viewController

注意:此代码表示应用程序支持除UIInterfaceOrientationPortraitUpsideDown 之外的所有方向(当设备为 iPhone 或 iPod Touch 时),并且可以修改以适应设备为和 iPod Touch 时的特定方向要求iPhone/iPad。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

【讨论】:

    猜你喜欢
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    • 1970-01-01
    • 2013-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多