Auto layout - growing a button to the left instead of right

I want to make a button grow to the left instead of right.

When I make a button add auto layout, then type the label, I can’t get the button or text to justify right so that my button grows left (or even middle). I found a google material design system button that does this so I know it can do it. I have been trying to figure this out way too long and need help :hugs:

I can’t upload a stupid attachment because I am a new user. so lame. :poop:


Hello there

Welcome to the community

You need to set constrain for it, if the upper frame does not have auto-layout
If it does, it will get handled by auto-layout properties

Let me show it in an screenshot:

If you look closely, you can see these 2 buttons have opposite constrains, and it is shown with a blue dot ruler visually and they are both in auto-layout, but one goes to right by changing the label and the other goes left. I made it in RTL lorem Ipsum language to understand it better.

If you use auto-layout on upper layer, It will behave on that setting, if you want both behavior under 1 auto-layout frame, its not possible, create 2

Here is more info on constrains:

Hope it helps you get on track

Thanks for this. It helps some but my button only has a word in it no icon. I tried to recreate what you did and it worked… until I removed the icon and then the button kept justifying left.

Hi Morgan, Like @SohrabNiroo said you need to add a constraint to it so it knows how to move. My guess is your button is placed on the canvas (in “empty space”) instead of in a frame. Try placing it inside a frame and set the constraints.