0

I have a ScrollView (containing a NSTextEditor) whose top, left and right constraints I've correctly set to 0 relative to its container (the main window).

I can't get its height to be half of the main container. Any help?

enter image description here

pistacchio
  • 56,889
  • 107
  • 278
  • 420
  • check this.....http://stackoverflow.com/questions/14935825/autolayout-make-height-of-view-relative-to-half-superview-height – Bhavin Bhadani Sep 01 '15 at 11:59

1 Answers1

0

If I have understood you correctly, this can be done with the following steps:

  1. Select the main container (tap "view" in the left panel)
  2. Select the scroll view (command+tap "scroll View" in the left panel)
  3. Tap the "Pin" button at the bottom
  4. Check "Equal Heights" in the popup
  5. Tap "App 1 constraint" button in the popup
  6. Select the constraint (tap "Equal Heights ..." from the "Constraints" group under "view").
  7. Change "Multiplier" in the right panel from "1" to "0.5".

That should do.

Joe Smith
  • 1,900
  • 1
  • 16
  • 15
  • I tried it, but when doing so, the "Equal Heights" checkbox is not checkable in the pin tab. – pistacchio Sep 01 '15 at 12:03
  • I tried the steps with my project in Xcode 7 before posting. Not sure why it doesn't work for you. Sorry for that. The only thing tricky here is step 2, you need to use command+tap so that both views are selected. – Joe Smith Sep 01 '15 at 12:36