Hi All,
We have properties to set content according to content length and device screen size which help us to manage user interface of an application. Content hugging priority and content compression resistance priority helps you to maintain User interface of application.
Let have an example : Place a button with top , leading , trailing and central horizontal constraint.
1) Leading constraint priority :- 1000 Trailing constraint priority :- 1000
Content hugging priority :- Horizontal : 250 Vertical : 250
Content compression resistance priority :- Horizontal : 750 Vertical : 750
2) Leading constraint priority :- 500 Trailing constraint priority :- 500
Content hugging priority :- Horizontal : 750 Vertical : 750
Content compression resistance priority :- Horizontal : 750 Vertical : 750
As you can see above button size contracts to minimum size.
3) Leading constraint priority :- 500 Trailing constraint priority :- 500
Content hugging priority :- Horizontal : 750 Vertical : 750
Content compression resistance priority :- Horizontal : 250 Vertical : 250
First increase leading constraint constant and leading constraint constant by 50 points
as you can see button text truncate from middle as content compression resistance is less than leading and trailing priority.
0 Comment(s)