Skip to main content
Solved

How can I dynamicaly scale an object to the height of a text box?

  • November 2, 2021
  • 2 replies
  • 3319 views

Grok

I have a design that requires a line on the left side to automatically scale to the height of the text box beside it. If only 2 lines are entered, that line should adjust to the new height, if 4 lines are entered, again it should scale to the new height of that text.

This feels like it should be fairly easy to do with auto-layout but I can’t seem to figure it out. My apologies if there is a very obvious solution to this.

Best answer by tank666

  1. Wrap the line and text in one horizontal Auto Layout;
  2. For the line, set the “Fill container” vertically in the “Resizing” section;
  3. For the text set “Hug contents” vertically and “Fixed width” horizontally.
View original
This topic has been closed for comments

2 replies

tank666
  • 4858 replies
  • Answer
  • November 2, 2021
  1. Wrap the line and text in one horizontal Auto Layout;
  2. For the line, set the “Fill container” vertically in the “Resizing” section;
  3. For the text set “Hug contents” vertically and “Fixed width” horizontally.

Grok
  • Author
  • 1 reply
  • November 2, 2021

I had a feeling this was going to be embarrassingly simple and I was sure I tried these settings, but I obviously missed something. Thank you so much for your help!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings