Cocoa Automatically layout and scroll view

I am in charge of the King of Property Inspector View. I use Auto Layout with Custom Layout (explicitly setting the frame property) only on the external panel. Let me explain:

  • Each line of view of the inspector properties is implemented by the PropertyCell inspector, which uses only Autolayout.
  • There is a special StackPanel control that stacks cells and also uses autostart. Each group has a stack panel. Group 04 is inside Group 03. Both are collapsible.
  • There is an external stack panel that groups all groups. This external stack panel sets the height explicitly using the frame property.
  • All this is contained within NSScrollView.

See image:

enter image description here

Everything works fine, but if I resized the window so that its content area is smaller than the entire inspection of the property inspector (so that I can scroll the view of the property inspector), then scroll down and then collapse the last group (group 04), view the property inspector shrinks and acts correctly. In addition, scroll view areas change accordingly. The problem is that I cannot undo collapse of group 04.

By setting several breakpoints in the code, I found that the problem. I just don’t know how to solve this. The problem is that although updateConstraints pass is called (because I call -setNeedsUpdateConstraints), -layout pass is not called. Even if I force the layout to pass by calling -layoutSubtreeIfNeeded, the automatic layout doesn't seem to have an effect, because the height of some cells that I set to 0 (using the constraint) when I do the collapse is still 0 when I split.

Skip layout is called again if I resize the window. Of course, this is unacceptable.

Please, help!!! I am going to completely disable the automatic layout and execute my own layout using only the layout ...

+4
source share
1 answer

I decided by calling the layout on subviews explicitly ... This is a bit strange ... But I need my children to be mocked before I stack (StackPanel).

0
source

All Articles