iosimageuikitlaunch-screen

Fixed ImageView in launch screen swiftui


I'm making a launch screen for an iPad and iPhone app with some text and an image. When I run the app, the image on the iPad (portrait mode) is really big (scaled). If I run it on the iPhone it's ok.

I'm using a picture in the Assets.xcassets and call it in an Image View in the LaunchScreen.storyboard. See picture below for the constraints what I'm using.

My constraints in the LaunchScreen

Please who could give me a help on how to make a fix Image size in LaunchScreen.storyboard for every device?


Solution

  • You have static offset constraints. These conflict with your size constraints, so the result is ambiguous.

    Remove them, and add center vertically+horizontally constraints instead.

    Also you can remove duplicated constraints, like this:

    enter image description here

    You can also preview how your view will look on other devices directly in the interface builder. Click on View as: in the lower left corner and change the device.