xcode background image full screen issue with missing constraints

46 views Asked by At

I'm trying to figure out why I cannot get an image to display fullscreen on one of my app screens within xcode. I know this is basic stuff, but for some reason xcode is just not having it.

I've tried everything I can think of (restarting, cleaning build, rebuilding the project, etc...) but this issue persists.

The problem is that, within xcode on the Story Board, it appears as full screen, but then in the simulator, it only appears as a small size, with top-left alignment.

Within xcode, there is a small red 'error' dot that says it is missing constraints but if I click that, it asks me if I want to fix it, I say yes to add the missing constraints, but it then just defaults back to the same red dot error and it never disappears.

enter image description here

<imageView clearsContextBeforeDrawing="NO" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" image="imglogo.png" translatesAutoresizingMaskIntoConstraints="NO" id="Q3R-Av-fe9">
    <rect key="frame" x="0.0" y="176" width="375" height="315"/>
        <constraints>
            <constraint firstAttribute="height" constant="315" id="YIQ-e1-var"/>
        </constraints>
</imageView>

On other screens within the app it works fine, but no matter what I try, I just cannot fix it, the image remains not full screen and the missing constraint errors persist.

Any suggestions what to try?

1

There are 1 answers

0
DonMag On

You want to constrain all 4 sides to the view - NOT the safe-area, and NOT relative to margins:

enter image description here

enter image description here