skip to Main Content

Have a few UIButtons (perhaps in a stack view), left align, and each with an image.

enter image description here

When you set the content inset left (4 in the example), the minX of the text (the "S" in the example) varies depending on the image width

In almost all cases, your designer is gonna want all the texts to align with each other left.

Is there some setting to align the texts "independently" ? Say, set the contentInset of the text separately from the image, or make the images a fixed width (they’d sit left within that width).

Obviously one could write a completely custom button, add the image yourself, but it seems incredible to have to do so for such a common need?

2

Answers


  1. Chosen as BEST ANSWER

    My life has been changed forever.

    enter image description here


  2. That’s what the configuration’s imageReservation property is for.

    It specifies how much room is to be set aside for image. If all the buttons have the same imageReservation value, the image section of all the buttons will be the same width.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search