Why won't my background image expand based on orientation or screen size?

Hello,


Working on a really simple learning app. Center and align three button, and have a background image fill the entire screen. However when I change the device in View As section (bottom of Xcode) the background does not self adjust for iPads, or horizontal oriantaion, etc.


I have the four constraints set to "view and 0"


There's no other functionality am practicing makeing a layout screen.


All my other buttons and text stay where they are if I change View As to any other device.


So I must be missing something.


Can someone help me please?


Thank you

Answered by Claude31 in 424750022

The image must be in a UIView, right ?


Define constraints for this UIView as Top, left, bottom right relative to safe area.

Then define the image inside to fill (take care of aspect ration however).


The same for buttons: define constraints relative to the safe area.

Accepted Answer

The image must be in a UIView, right ?


Define constraints for this UIView as Top, left, bottom right relative to safe area.

Then define the image inside to fill (take care of aspect ration however).


The same for buttons: define constraints relative to the safe area.

Why won't my background image expand based on orientation or screen size?
 
 
Q