【问题标题】:"Application windows are expected..." error when loading storyboard for Ipad为 Ipad 加载情节提要时出现“应为应用程序窗口...”错误
【发布时间】:2015-01-05 15:17:31
【问题描述】:

我正在为 Iphone 和 Ipad 加载不同的情节提要,并且 Iphone 的情节提要加载良好,但是当我启动 Ipad 模拟器时,我得到了“应用程序窗口是预期的...”错误。

这是 AppDelegate 中的代码:

@implementation AppDelegate

- (UIStoryboard *)grabStoryboard {

    UIStoryboard *storyboard;

    // detect the height of our screen
    int height = [UIScreen mainScreen].bounds.size.height;

    if (height == 480) {
        storyboard = [UIStoryboard storyboardWithName:@"Storyboard_Iphone3" bundle:nil];
        // NSLog(@"Device has a 3.5inch Display.");
    }

    if (height >= 1024 && height <= 2048 ) {
        storyboard = [UIStoryboard storyboardWithName:@"Storyboard_Ipad" bundle:nil];
        NSLog(@"Device has a 4inch Display.");
    }

    else {
        storyboard = [UIStoryboard storyboardWithName:@"Storyboard_Iphone4Up" bundle:nil];
        // NSLog(@"Device has a 4inch Display.");
    }

    return storyboard;
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIStoryboard *storyboard = [self grabStoryboard];

    // show the storyboard
    self.window.rootViewController = [storyboard instantiateInitialViewController];
    [self.window makeKeyAndVisible];
    return YES;
}

在控制台中,我看到 NSLog 消息,但情节提要未加载,并且出现“应用程序窗口...”错误。

我正在使用一些滚动视图和一些元素,但我认为这些不是问题,因为它们有一个选项“调整滚动视图插图”。

我上传了一些屏幕截图来展示我的项目的更多信息。感谢您的宝贵时间。

【问题讨论】:

    标签: ios iphone xcode ipad storyboard


    【解决方案1】:

    我想通了。当您将所有内容从 Iphone 故事板复制到 Ipad 时,初始视图控制器复选框未选中。只需检查一下,一切都会好的(:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-02
      • 1970-01-01
      • 2022-01-04
      • 1970-01-01
      • 2016-03-01
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      相关资源
      最近更新 更多