简体   繁体   中英

How to set a launch screen image in Xcode

I am working on a iPhone App and I am trying to set a launch screen image . How can I set a launch screen image , is it possible to add a UIImageView and assign it a image?

If you need more information to answer the question then please let me know.

Thanks in advance

在此输入图像描述

Yes, you can easily set a UIImageView in the LaunchScreen. Simply delete the pre-existing labels from the LaunchScreen.xib , add a UIImageView from the Interface Builder. Assign the following 4 constraints to that UIImageView with respect to the parent view:

  • Bottom Space to container
  • Top Space to container
  • Leading Space to Container
  • Trailing Space to Container

And finally set the image to the UIImageView .

Hope this helps you in what you wanted to do.

Update:

Have a look at the following image for further description:

In iOS 8 and later, you can create a XIB or storyboard file instead of a static launch image. When you create a launch file in Interface Builder, you use size classes to define different layouts for different display environments and you use Auto Layout to make minor adjustments.

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/LaunchImages.html

For adding a launchimage(or any type of image), in Xcode(9.4.1), simply go the Assets.xcassets and you can add it from the self-explanatory addition feature there. For my iphone app, i simply added it, in a jiffy. Also, you need to follow the instructions for adding constraints for the image, as described by one of the answerers with screenshot, above. Finally, you can save and test to see/verify your launch image appearing in the launch of your app.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM