我想加载不同的故事板,但我得到这个错误应用程序窗口预计在应用程序启动结束时有一个根视图控制器。任何人都可以帮助我加载不同的故事板导致错误
- (UIStoryboard *)grabStoryboard {
UIStoryboard *storyboard;
// detect the height of our screen
int height = [UIScreen mainScreen].bounds.size.height;
if (height == 480) {
storyboard = [UIStoryboard storyboardWithName:@"iPhone_4" bundle:nil];
// NSLog(@"Device has a 3.5inch Display.");
}
if(height == 568)
{
storyboard = [UIStoryboard storyboardWithName:@"iPhone_5" bundle:nil];
// NSLog(@"Device has a 4inch Display.");
}
if(height == 667)
{
storyboard = [UIStoryboard storyboardWithName:@"iPhone_6" bundle:nil];
// NSLog(@"Device has a 4inch Display.");
}
if(height == 736)
{
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
// NSLog(@"Device has a 4inch Display.");
}
return storyboard;
}
这个错误几乎肯定存在于你的appdelegate中的applicationdidfinishlaunching函数中。发布以及 – chedabob
作为一个方面说明,真的不应该有一个理由为你的每个iPhone屏幕尺寸加载一个不同的故事板。自动布局和大小类可以以更加优雅和可管理的方式处理... –