1

I have four text boxes positioned like this on my view:

|----| |--------| |----| |---------|

As you can see, the first in each group is one width and the second is a different width (but equal to each other).

I've placed these on my view in landscape orientation. What I want to happen is have all four scale down when I rotate to portrait orientation.

I've tried constraining every which way I can think of and the closest I can come to getting it to work is having the two on the left stay the same size and the two on the right squish up.

i.e.

|----| |--------| |--| |----|

What I really need is for all four to squish up equally like this:

|---| |------| |---| |------|

How can I set the constraints in my storyboard so that it works? (Please note: I do not want to do this in code as the view I'm building is a very detailed form-like page and will have a ton of text boxes on it--I don't want to code that much.)

Thanks!

Kent
  • 1,705
  • 3
  • 16
  • 26
  • Have you tried setting minimum widths on each button? Also look into content hugging and compression resistance (http://stackoverflow.com/questions/15850417/cocoa-autolayout-content-hugging-vs-content-compression-resistance-priority) – Kyle C Dec 03 '13 at 00:06
  • I found a solution. What I did was select all four boxes and set left and right constraints. Then I selected box #1 and box #3 (from left to right) and set "Equal Widths" constraints. Then I selected box #2 and box #4 and set "Equal Widths" constraints. I probably overdid something, but this worked. – Kent Dec 03 '13 at 00:54
  • Also, thanks for the other article link Kyle C. Very good stuff. – Kent Dec 03 '13 at 00:55

0 Answers0