I have an NSOutlineView that I have programmatically added into an NSScrollView:
outlineView = ECOutlineView()
outlineView.translatesAutoresizingMaskIntoConstraints = false
scrollView.documentView = outlineView
The scrollview is constrained to the window it is in. Everything behaves as expected except for the fact that the scrollView doesn't react to changes in the outlineView length.
For example, if a row is expanded, lengthening the outline view, the scrollview does not adjust to allow scrolling to the new content.
Some scroll synchronisation does work. If I scroll down to the end of the outliner and start deleting rows, the scroll position is updated so that the new bottom row is aligned with the bottom of the scroll view, however the scroll scope is still incorrect.
If I resize the window slightly, the scrollView will update and give the correct scroll scope.
So, it looks as though constraints are correct, I just need to force an update - but shouldn't this be happening automatically?
translatesAutoresizingMaskIntoConstraints
to false? What happens if you don't? In general, a container view is responsible for controlling that property for the views it's managing, because only it knows how it's managing the position. And, you should leave it at the default in case you're working with a container view that doesn't know about auto layout. – Ken Thomases