Delegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard * storyboard = [self grabStoryboard];
self.window.rootViewController = [storyboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
return YES;
}
- (UIStoryboard *) grabStoryboard {
int screenHeight = [UIScreen mainScreen].bounds.size.height;
UIStoryboard * storyboard;
switch (screenHeight) {
case 480:
storyboard = [UIStoryboard storyboardWithName:@"Iphone-4" bundle:nil];
NSLog(@"4");
break;
case 568:
storyboard = [UIStoryboard storyboardWithName:@"Iphone-5" bundle:nil];
NSLog(@"5");
break;
case 667:
storyboard = [UIStoryboard storyboardWithName:@"Iphone-6" bundle:nil];
NSLog(@"6");
break;
case 736:
storyboard = [UIStoryboard storyboardWithName:@"Iphone-6-Plus" bundle:nil];
NSLog(@"6+");
break;
case 1024:
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
NSLog(@"Ipad");
break;
default:
NSLog(@"Wron");
break;
}
return storyboard;
}When testing out how my images look on the Ipad2 it shows the images from the iphone4 and the debugger logs "4". This is the only simulator that I have an issue with. All of the other ones who their own images and log the correct screen.
Hard coded screen dimensions like that are a strong code smell. You really should try not to fight the frameworks - just use one storyboard and size classes, or maybe one for iPad and one for iPhone if you absolutely must.
In any case, when the OS reports the 3.5" size it's usually due to an iPhone-only app with incorrect launch images. If no appropriate launch images for the device are found, it gives your app the 3.5" screen.
However if this is a universal app, it shouldn't ever be giving you 480 points on an iPad. Possibly something is corrupted in the binary being deployed to that sim. Perhaps you just need to do a clean build folder (cmd-opt-shift-K) and completely remove the app from that simulator to ensure you're starting with a clean slate.
(BTW it's "iPad" and "iPhone". Using incorrect capitalization is a bad habit and will cause you grief when your app gets rejected some day because you included the incorrect spelling in the app or website somewhere.)