Reputation: 612
Here is a picture of the problem:
The error message says that height and vertical positions are ambiguous for "Picture Message Text View".
And here are the constraints for the pictureMessageTextView
:
Now, when I change the height the height constraint from Height >= 100
to Height = 100
, the error goes away. However, if I keep it the way it is now, the error remains. And the reason why I want my height constraint to be Height >= 100
is so that it can increase in size depending on the size of the text inside the textView. Any suggestions to get rid of the error?
Upvotes: 3
Views: 2583
Reputation: 469
You have ambiguity because you defined too many constraints. The rule of thumb is to have both leading and trailing space contraints or one of them with a dynamic width(width>=100 for instance). The same applies to vertical(top, bottom and dynamic height). So when you have all of the three constriants defined for either vertical or horizontal space, you'll get an ambiguity problem.
If you use the center vertically or horizontally, you're simultaniously setting the leading and trailing(or top and bottom respectively) as equal to each other so adding dynamic width (or height) would cause ambiguity in a similar fashion
Upvotes: 1
Reputation: 3328
If you want dynamic height of textView
then you should remove the bottom-space constraint
. This should also fix the error you are getting. You are getting this error because the textview'height
is less than 100 based on the top-space
and bottom-space
constraints.
Upvotes: 1