I need to autolayout a storyboard UIView with a single UIControl. The UIControl should be centered, needs to have a aspect ratio of 1:1 and should always use 90% of the superviews width or height depending on the device orientation without clipping.
I added 4 constraints
- Center Y Alignment - View - Superview
- Center X Alignment - View - Superview
- Equal Widths - View - Superview with multiplier set to 0.9
- Aspect Ratio - View - View with multiplier set to 1:1
This setup works fine in portrait mode but fails in landscape mode. (See pictures below)
What kind of constraint do i need to solve this problem. Do i have to change the constraints if the device is rotated?
Portrait mode
Landscape mode - wrong
Landscape mode - mockup. Thats what i want.