Apple’s auto layout guide states that constraints cannot be set to cross a view within the hierarchy if it sets the bounds manually using a -[NSView layout]
or -[UIView layoutSubviews]
override. It is also not possible to cross a view that has a bounds transform such as the NSScrollView
. What this means, is that because the constraints aren’t aware of the bounds transform or the manual manipulations on the frame property of a view, a hierarchy of views where the ancestor A containing a NSScrollView
S which in turn contains a child C cannot set constraints on C that are related to A. S acts as a barrier for the constraint system.
Auto layout is an incredibly powerful tool and the official documentation advertises it as something that is easy and natural to use. Yet, there are some dark corners that aren’t explored at all within it. Among those, the NSSplitView
is one that has been quite a piece of work for me. This article is meant to shed some light on how to use auto layout with Apple’s NSSplitView
.