简体   繁体   中英

Understanding what "greater than or equal" and "less than or equal" are in Auto Layout

suppose I have this layout:

在此处输入图像描述

I would like to set contraint from trailing of the color view to the superview in such a way that when the label expands, it will push the colored view to the right, but not exceeding the screen.

So, what I understand is, setting trailing of the colored view to superview with less than or equal relationship will do the trick. But it does not.

在此处输入图像描述

So, what is really the use of greater than or equal and less than or equal anyway?

set color view's trailing constraint to greater than or equal to some constant! And it will manage space equal to that constant!

Your label should be self sizing, I mean should increase width with content and you should give fixed width to your color view!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM