iOS — content hugging and content compression resistance priorities

Priorities are very much important when dealing with autolayout. Every constraint has a priority. It is just a number ranges from 0–1000 .

STOCKSNAP.IO
Intrinsic content size (Apple docs)

Content hugging priority:

horizontal content hugging priority: green(251)- blue(251)
horizontal content hugging priority: green(250)- blue(251)
horizontal content hugging priority: green(252)- blue(251)

Content compression resistance priority:

Button horizontal compression resistance priority is 750 and button width constraint priority is 1000
Button horizontal compression resistance priority is 1000 and button width constraint priority is 999

That’s it. !

If you enjoyed reading this post, please share and give some claps so others can find it 👏👏👏👏👏 !!!!

iOS and tvOS developer, dreamer, photographer 🤨