Search code examples
macosautolayoutinterface-builder

Where is dragThatCannotResizeWindow in Interface Builder/Storyboard?


I found the NSLayoutConstraint.Priority.dragThatCannotResizeWindow to be very useful. Though I usually write constraints with code, it sometimes gets too long and I want to move them to IB.

How I can set the priority of a constraint to be dragThatCannotResizeWindow in Interface Builder? There are only 3 options, corresponding to required, defaultHigh, defaultLow in code.

enter image description here

I tried looking up dragThatCannotResizeWindow storyboard on Google, and nothing useful came up (< 50 results!)

There are also a bunch of other priorities like dragThatCanResizeWindow, and fittingSizeCompression, which I'm also interested about.

One guess I had was that unlike required, defaultHigh, defaultLow, these "semantic" priorities don't have a fixed value, and hence cannot be selected in the storyboard.* Is this true? If so, what does their values depend on?

*This is kind of a weak reason since semantic colors like "label" and "background" don't have a fixed value either and they are in IB...


Solution

  • .Priority is a struct with these "semantic" defined values:

    .required:                       1000.0
    .defaultHigh:                     750.0
    .dragThatCanResizeWindow:         510.0
    .windowSizeStayPut:               500.0
    .dragThatCannotResizeWindow:      490.0
    .defaultLow:                      250.0
    .fittingSizeCompression:           50.0
    

    As we know, Storyboard / IB lists only Required, High and Low ... but we can type any value between 0 and 1000 into the Priority field.