简体   繁体   中英

Placing Image in iOS LaunchScreen.storyboard disables launch screen completely

I'm using SwiftUI and Xcode 12.2 (iOS 14) for a project and building a launch screen using Interface Builder. It works fine, but whenever the launch screen includes a reference to any image file (for the contents of an Image View), the launch screen no longer works at all—instead a black screen appears. Without any images, the launch screen appears fine.

I see that this problem has been reported on and off in recent years, and the fixes include:

  1. Move the images out of the asset catalog and/or
  2. Delete derived data, delete app from simulator/device, clean build folder.

I've tried both of these with no success. Neither in Simulator nor on physical device. Any thoughts?

Have you tried to add constraint to your image like so :

Image("myBackgroundImage") .resizable() .aspectRatio(contentMode: .fit)

Maybe your image is too big to be displayed on the view

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