Regarding Hugging & Resistance property

I have query in sub-topic “Nested stack views”

  1. we are decreasing/setting the textField “Horizontal Content Compression Resistance Priority” to 749

  2. My question is as follows.

Instead of changing “Resistance Priority” of textField, can we decrease textField’s “Horizontal Content Hugging Priority” to 249 & achieve the same effect?

Thanks

No. The effect here is to reduce the size of the text field over the label when horizontally constrained.

Think of the compression resistance priority as auto layout deciding which view(s) will have their dimensions change when constraints on the views want to decrease its width. The higher the priority, the lower the tendency to want to decrease its dimension.

Changing the hugging priority would affect how much a view wants to increase their width relative to its neighbouring views if presented with the option. The higher the priority, the lower the tendency to want to increase its dimension.