So I am making an iPhone app and I would like to have a different storyboard for each screen size. (1 for the iPhone 6 and 1 for the 6 plus and 1 for the 4 and 1 for the 5) I know that I can use size classes but I have my reasons for wanting to use multiple storyboards. Anyway In order to do this I put the following code in my app delegate...
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIStoryboard *storyboard = nil;
if ([[UIDevice currentDevice] userInterfaceIdiom] ==UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:@"3inchstoryboard" bundle:nil];//iPad
} else {
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
if (screenSize.height == 480){
storyboard = [UIStoryboard storyboardWithName:@"3inchstoryboard" bundle:nil];//iPhone 3.5inch
} else
if (screenSize.height == 568){
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];//iPhone 4inch
}
else
{ if (screenSize.height == 667){
//storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];//iPhone 4.7inch
} else
if (screenSize.height == 736){
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];//iPhone 5.5inch
} else
//default storyboard
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
}
}
self.window.rootViewController = [storyboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
This code does not work. Every time I run it, no matter the screen size, the device always goes to the default at the bottom of the code. It worked on my iPhone 5 only and my iPhone 5 is running iOS 7. I have definitely deleted the bar in the plist for the default interface but it still will not work. So what can I do to make this work! I would really appreciate your help!