I'm trying to use a static image on my LaunchScreen.storyboard
, so we need unique sizes for each device.
In my assets folder I can great a launch image Image Set
that allows me to add images for each device, however I just get a blank launch image when I use these in an Image View
. A regular image doesn't give enough options (only 1x, 2x, 3x for iPhone/iPad). What's the best way to do this?
To clarify: how can I use a full screen static image that fits on say both a 4S and iPhone 5 when both those images are technically 2x? Creating a new launch images asset gives all these options for different screen sizes, however it can't be used in storyboard as an image like a regular asset.
Instead of using the LaunchImage
set, add a normal image set of the image that you want to be on the launch screen to your .xcassets file. Next, add a UIImageView to the UIViewController in your LaunchScreen.storyboard
and set the image using the Attribute Inspector.
Step 1: Add your image assets to the .xcassets file
Step 2: Add a UIImageView to the LaunchScreen.storyboard file
Step 3: Add constraints to the UIImageView and set the image in the Attribute Inspector
BTW , don't forget to make sure that the Launch Screen File
in your .xcodeproj is set to your LaunchScreen starboard file!
You should now be good to go!
If you want to use a full screen static image on launch, you can use just a LaunchImage set in your .xcassets file.
If you don't already have a .xcassets file in your project, add a new file like so: File > New > File > iOS Resource > Asset Catalog.
Next, open your .xcassets file and right click > App Icons & Launch Images > New iOS Launch Image
Now you can add specific launch images for iPhone 4(S), 5(S/C), 6(S) and 6(S) Plus. (BTW, I've selected only the portrait orientation for this image set).
The last, and very important step, is to leave the Launch Screen File field in blank in your target settings!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.