I´m trying to use a NSTextView with the new Vibrant theme in OSX 10.10 after watching the session from WWDC on advanced features of the new UI. My textview is not placed adjacent to the titlebar so I have made the content view fully sized so I can place the textview beneath titlebar.
My problem is that I have a NSView between the textview and titlebar which should be placed directly beneath the titlebar but I can not get auto layout to do this for me. In the video they're giving this sample code using the new contentLayoutGuide property in NSWindow:
NSLayoutConstraint *topEdgeConstraint = [NSLayoutConstraint constraintWithItem:myView attribute: NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:window.contentLayoutGuide attribute:NSLayoutAttributeTop];
However I can not get this to work, whenever I try to install the constraint Xcode gives me "Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal.". I get that the window property used in the example is not in the subtree of the view since the view is placed inside the window but how am I supposed to access the contentLayoutGuide property?
Currently I´m trying to add the constraint in the -awakeFromNib method in a subclassed NSWindow. Wrong approach maybe?
Thanks in advance