Search code examples
iosautolayoutinterface-builderxcode-storyboard

Image in launchscreen storyboard not visible despite matching width/height constraints


I've got a UIImageView in my LaunchScreen.storyboard file that I want to fill the view, so I command-click-drag from the image to the containing view and select Equal Widths and Equal Heights. When run, the background image isn't visible (all I see is the logo image).

Here is the scene hierarchy with constraints:

Scene hierarchy


Solution

  • You haven't set any constraints which define the origin of your background image. This may cause your image to be misplaced. Don't you have any layout errors or warnings in this view controller?

    For the background image I recommend you to replace equal width and height to the superview with leading, trailing, top and bottom constraints to the superview.

    This is the example solution

    example layout solution