So, starting with Xcode 6 we have got a new super-useful feature of Launch Screen template
According to it's description it can help create a launch screen that will work correctly on every device/resolution/orientation and we don't have to make a bunch of different screens for different resolutions with Assets Catalog anymore.
but... I have failed to find any useful tutorial on how to actually use this to make a single launch screen using a single image for all resolutions (only for landscape).
I know how to make a UI element centered on all resolutions using constraints, but i can't figure out how to make my UIImage scale to fill screen height on all resolutions. If i just resize my UIImage to fill current screen size selected in Simulated Metrics - it will fill only that one, but will not work with other screen sizes..
Can somebody give me a clue? how to make UIImage fill entire screen for all resolutions using this Launch Screen template?
If you simply just want to fill your launch screen with an image in every screen size, you can use leading, trailing, top and bottom constraints between your UIImageView
and the superview. So:
Step 1
Add your UIImageView
to your LaunchScreen.xib
and set whatever image it should display.
Step 2
Select your newly added UIImageView
and click the "Pin" icon at the bottom right of Interface Builder.
Step 3
Select all 4 edges og set the constants to 0. This makes sure that your UIImageView
has 0 points of space to the superview on every edge.
It looks like this:
That said, you should consider if this is the way to go. The idea of having a .xib file as a launch screen is really intended to replace the need of having to show full screen launch images. Instead, consider placing whatever elements your launch image contains in the interface builder instead. Also remember that you're (unfortunately) not able to tie any code together with your launch screen .xib file.