How to align an icon and a textlabel using scale

Hello!

As the title of this topic says, I want to know how to align an icon to a textlabel using Scale.

I want to achieve something like the screenshots below…
image

image

This should be centered on all screen sizes.

The Problem
The issue I am facing is how to get the image/icon to not be stretched and be a perfect square. On some screen sizes, the image can be distorted or out of place. Another issue I am also facing is centering the icon to the text label.

Solutions I tried before
Some solutions I tried so far is adding a UIAspectRatioConstraint onto the icon. The icon wasn’t distorted on all screen sizes, but it caused another problem. The icon and text wouldn’t center, or there is just a big gap between them.

I accept answers that give offset. There should be scaling on all devices though.

Use the “Fit” ScaleType for your icon, it is a property. To ensure that there is no awkward gap or misalignment on different resolutions, keep the icon and text inside of a container frame, e.g-

1 Like

Sorry for the late reply. It works! Thank you :slight_smile: