A quick summary of the concepts:
- Hugging => content does not want to grow
- Compression Resistance => content does not want to shrink
Example:
Say you've got a button like this:
[ Click Me ]
and you've pinned the edges to a larger superview with priority 500.
Then, if Hugging priority > 500 it'll look like this:
[Click Me]
If Hugging priority < 500 it'll look like this:
[ Click Me ]
If the superview now shrinks then, if the Compression Resistance priority > 500, it'll look like this
[Click Me]
Else if Compression Resistance priority < 500, it could look like this:
[Cli..]
If it doesn't work like this then you've probably got some other constraints going on that are messing up your good work!
E.g. you could have it pinned to the superview with priority 1000.
Or you could have a width priority. If so, this can be helpful:
Editor > Size to Fit Content
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…