Tutorial 1: Supporting the iPhone 6 and up - Pages 138 and 139

I’m surprised to know that there is a way to scale up apps to fit the 4.7 and 5.5 inch sizes beside using the typical Auto-layout and Size Classes.

Can someone summarize the “official” way of that hacking method? I mean, as the book says; by simply removing the launcher storyboard, the app automatically scales to fit larger screen sizes.
1- Why does removing the launcher screen enables this hack? It just doesn’t make sense to me.
2- To fix the 2 black bars at the sides, we added the “Default-568h@2x.png”. What’s special about the file’s name that made Xcode use it for the launch screen and to fix the 2 bars issue?

I totally get that it’s a hack but what’s the technical background to it working that way? It’s just so weird to me.

The very first screen size was 320x480 pixels. Then Apple kept coming out with new devices that had larger screens, so they introduced ways for apps to make use of these larger screens. These ways have changed over time… until today, where we have size classes. Maybe in iOS 11 it will be different again. So a lot of these choices are because of historical reasons.

I’m still confused. I don’t think you answered my question @hollance :frowning:

Maybe I’m not sure what exactly you’re asking.

1 Like

1- Why does removing the launcher screen enables this hack? It just doesn’t make sense to me.
2- To fix the 2 black bars at the sides, we added the “Default-568h@2x.png”. What’s special about the file’s name that made Xcode use it for the launch screen and to fix the 2 bars issue?

:smiley:

It works this way because Apple chose to make it work this way. If you want to know exactly why and why not some other way, you’ll have to pick the brains of the Apple engineers who made these decisions.

Oh okay I get you. So there is no technical explanation behind how they made it work that way.
So what about the background image, what’s special about its name that made it work that way? I mean, we simply had to copy it to the project’s folder and it worked right away. We didn’t assign it as a Launch Screen and we didn’t use it as a UIView/UIImage any where. Of course I’m talking about the “Default-568h@2x.png”.
In other words, if I need to use this particular hack, all I have to do is to remove the Launch Screen and rename the image I’d like to be presented as a Launch Screen to “Default-568h@2x.png” ?
Sorry if I’m slow :smiley:

Hey, slow and steady wins the race. :wink:

Before there was a Launch Screen option you had to provide some images in your project with special names. These names were Default.png, Default@2x.png (when Retina was added), and Default-568h@2x.png (when 4-inch screens were added). After that, Apple changed how this works and created the Launch Screen option. But if you wanted to you can still use these Default.png images to serve as the launch screen.

In practice, only Default-568h@2x.png is still used for the special case of scaling up the screen to the larger iPhone 6 and 7 models, as we do in the tutorial.

1 Like

Okay that makes a lot of sense now.

So one last question. Let’s say I’m making a game and I want to avoid making the playable area smaller for larger iPhones so players wanting those larger screens don’t get an advantage. Would it be okay to use this hack while also providing @3x image files for the assets so that the assets would remain sharp for the bigger iPhones?
So in other words, if I use this hack, would my app still utilize @3x image files for larger screens?

Is there a better way to achieve scaling in games other than playing around the playable area concept, if that makes sense?

Thanks a lot :slight_smile:

I don’t think the app would use the @3x artwork in this case but I am not sure.

Most of the time you wouldn’t use UIKit to make a game but something like SpriteKit and you’d let SpriteKit handle the scaling (in which case the app would use the 3x artwork) instead of using this hack.

1 Like