Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Width and Horizontal Position Are Ambiguous

it seems I have created a simple Image view with the following constraints:

Align Center X to: Superview

Align Center Y to: Superview

Top Space to: Top Layout Guide

Bottom Space to: Bottom Layout Guide

And I have the Width and Horizontal Position Are Ambiguous message. I am trying to correct it, but I am not sure about what is happening in the first place.

Do you have an idea?

like image 341
Glyphs Avatar asked Feb 09 '16 10:02

Glyphs


2 Answers

You need to add the same constraint for left and right as you did for top and bottom.

Or set fixed width.

like image 54
konrad.bajtyngier Avatar answered Oct 15 '22 13:10

konrad.bajtyngier


Remove Top Space to: Top Layout Guide and Bottom Space to: Bottom Layout Guide constraints, Set Image's Width and Height instead or (Width + Aspect ratio). Because every view needs x,y, height, width to render itself.

So You've already set X and Y using Align Center X to: Superview and Align Center Y to: Superview. So it needs specific width and height now.

like image 1
rushisangani Avatar answered Oct 15 '22 13:10

rushisangani