Ali Mir
Ali Mir

Reputation: 565

How do I add uiimage left of uilabel in stackview?

I'd like to accomplish the following result: enter image description here

When I add the uilabel and uiimage to a stackview, no matter what I do the size of the image increases to original so it looks like:

[BIG IMAGE] small text

How do I fix this?

Upvotes: 0

Views: 133

Answers (1)

TheAppMentor
TheAppMentor

Reputation: 1099

  1. To the image view, add a constraint to set its height to be equal to the Label.
  2. Set the image view to have an aspect ratio of 1 : 1.
  3. Make sure the stack view itself has constraints to determine its height and width.

Your result will look like this.enter image description here

Upvotes: 1

Related Questions