iOS autolayout 中content Hugging 与content Compression Resistance

本文内容来自: stackoverflow

hugging

hugging=>content dosen't want to grow(即抗拉)

compression resistance

compression resistance=>content doesn't want to shrink(即抗压)

例如:我们设置button 为 ** [ click me ]**.设置button 与superview 的pin优先级为500.

1.设置button的content hugging 优先级 >500,那么button将会显示为[click me],但是如果content hugging的优先级<500的话,则会正常显示。

2.设置button的content Compression resistance优先级>500,如果super view被压缩,则button将会显示为[click me],但是如果content compression resistance的优先级<500,则将会显示为[cli...]

你可能感兴趣的:(iOS autolayout 中content Hugging 与content Compression Resistance)