我想加載不同的故事板,但我得到這個錯誤應用程序窗口預計在應用程序啓動結束時有一個根視圖控制器。任何人都可以幫助我加載不同的故事板導致錯誤
- (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屏幕尺寸加載一個不同的故事板。自動佈局和大小類可以以更加優雅和可管理的方式處理... –