I know with auto layout button text can be aligned left and grow to the right, or aligned right and grow left. Is it possible for button text to grow from the centre, left and right?
Yep, easy. But itâs not about button, but the parent frame where the button sits
I think I sort of tried that. I have text inside a frame inside an auto layout. If I have the frame spacing mode set to âspace betweenâ the text will from the centre (exactly what I want) but my rectangle wonât grow with the text.
Button:
Auto Layout Frame set to Hug Content (= resize with different text)
Parent frame:
Auto Layout with Alignment top center or center center
If the parent frame doesnât utilize Auto Layout youâll need to adjust the constraints of the Button and set left and right to center. Change the button position and align it to the center as well.
The alignment of the text doesnât matter here by the way.
Spacing mode doesnât need to be set to âspace betweenâ if youâre using one element only.
âPackedâ is the more correct way to do it. If theres only one element the result is the same though. 😀
The only problem with setting to âpackedâ means the text will only grow to the right 🙂 whatever gets the job done ay! 🛠️ 😀
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.