Search code examples
iosswiftuistackviewnsstackview

Horizontal StackView issue for multiline label and fixed size icon image


I want to show a an icon image which is fixed size of 20px X 20px ,It is showing good when a label is only one line but not showing accurately when label became in two lines.Screenshot is attached.

enter image description here


Solution

  • Working Constraints.!

    1. Set inner Stack view Alignment to Top and Distribution set to Fill Proportionally
    2. Set width of icon to fixed of 20px(No Aspect ratio and no Height)
    3. Set icon Content Compression Resistance property Horizontal priority to 1000.

    Images attached

    enter image description here

    enter image description here