我有不同的故事板文件,以支持不同的iPhone,我有这样的代码在我的appDelegate:我每次编译和运行应用程序崩溃说,它无法找到时间错误打开我的项目中的故事板文件
if (window.frame.size.height == 568){
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain5Name bundle:[NSBundle mainBundle]];
id rootViewController = [storyBoard instantiateInitialViewController];
[window setRootViewController:rootViewController];
} else if (window.frame.size.height == 480){
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain5Name bundle:[NSBundle mainBundle]];
id rootViewController = [storyBoard instantiateInitialViewController];
[window setRootViewController:rootViewController];
} else if (window.frame.size.height == 667){
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain6Name bundle:[NSBundle mainBundle]];
id rootViewController = [storyBoard instantiateInitialViewController];
[window setRootViewController:rootViewController];
} else if (window.frame.size.height == 736){
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:kMain6plusName bundle:[NSBundle mainBundle]];
id rootViewController = [storyBoard instantiateInitialViewController];
[window setRootViewController:rootViewController];
}
在NSBundle中的故事板文件,我把上面的代码注释掉,然后再次运行。我的代码有什么问题吗?
你为什么不告诉我们这些故事板的名称和项目导航器的截图? 如果说不能找到他们,那么也许你有一个错误的名字或两个。 – 2015-02-23 21:12:33
同上,我们需要知道'kMain5Name'是否在你的项目中。该错误表明它或它的同伴不在您的项目中。 – 2015-02-23 21:13:31
有点相关,您可能只需使用自动布局和大小类来处理不同的设备大小。你有没有使用这些工具的原因? – 2015-02-23 21:14:22