Quick summary of the concepts:
and an example:
Say you've got button like this:
and you've pinned the edges to a larger superview with priority 500.
Then, if Hugging priority > 500 it'll look like this:
If Hugging priority < 500 it'll look like this:
If superview now shrinks then, if the Compression Resistance priority > 500, it'll look like this
Else if Compression Resistance priority < 500, it could look like this:
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
|
2017년 10월 10일 화요일
content hugging vs content compression resistance priority
https://stackoverflow.com/questions/15850417/cocoa-autolayout-content-hugging-vs-content-compression-resistance-priority/16281229#16281229
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기