I'm current running the iPhone 6
simulator in my project.
I know with different iPhones you need different resolution settings.
If I want to develop for the iPhone 4
, 5
, 6
and 6+
. In my situation, what should be the sizes for 4
, 5
and 6+
. I think I don't need to change 6
because I'm using it as my base.
(If you could, please add iPad to list)
If someone could in direct me to how iOS automatically selects the right image resolution according to what device they have.
Any questions just comment!
I did this in Objective-C a while ago, so forgive me if it's different for Swift.
You have to make a different .storyboard
file for each image resolution, and then in your AppDelegate.m
you add a some code like:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *iPhone4storyBoard = [UIStoryboard storyboardWithName:@"storyboard4" bundle:[NSBundle mainBundle]];
// Device is an iPhone 5 or 5S
UIStoryboard *iPhone5storyBoard = [UIStoryboard storyboardWithName:@"storyboard5" bundle:[NSBundle mainBundle]];
// And so on...
if ([UIScreen mainScreen].bounds.size.height == 568.0) {
self.window.rootViewController = [iPhone5storyBoard instantiateInitialViewController];
} else if (/* test for other devices here */){
self.window.rootViewController = [iPhone6storyBoard instantiateInitialViewController];
}
[self.window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
return YES:
}
Which checks for device resolution, and applies the relevant storyboard.
Also, a suggestion for resizing images: Use Prepo.
Prepo automatically resizes app icons and splash screens to the desired values.