I have an NSTabView with multiple tabs, each containing an NSScrollView. In the scollviews I dynamically place custom views which are sized using autolayout and constraints.
Now if I add my custom views to eg. tab1 and resize the window with this tab active everything works fine and autolayout does not complain.
On the other hand, if I add my custom views to tab1, switch to another tab, resize the window, and switch back to tab1 autolayout breaks with the following message:
Unable to simultaneously satisfy constraints:
(
"<NSAutoresizingMaskLayoutConstraint:0x4011d8f60 h=-&- v=-&- H:|-(0)-[FlippedDocumentView:0x4011b76e0] (Names: '|':NSClipView:0x40120eb80 )>",
"<NSLayoutConstraint:0x4012a5c80 H:|-(10)-[TextViewModuleView:0x401236e80] (Names: '|':FlippedDocumentView:0x4011b76e0 )>",
"<NSLayoutConstraint:0x4011148e0 H:[TextViewModuleView:0x401236e80]-(10)-| (Names: '|':FlippedDocumentView:0x4011b76e0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x4011d8f00 h=-&- v=-&- H:[FlippedDocumentView:0x4011b76e0]-(0)-| (Names: '|':NSClipView:0x40120eb80 )>",
"<NSAutoresizingMaskLayoutConstraint:0x4011d5e00 h=--& v=--& H:[NSClipView:0x40120eb80(0)]>"
)
My question is, why does the autolayout work fine for the active tab and does for inactive?
UPDATE: I am quite sure it is a bug. I made the simplest possible program just using IB in autolayout mode (no code at all):
I drag a tab view (it gets automatic leading,trailing,top and bottom constraints)
onto one of the tabs I drag a scroll view (it gets automatic leading,trailing,top and bottom constraints)
onto the scroll view I drag a text field (it gets some automatic constraints) but I setup the leading,trailing,top and bottom constraints to allow for resizing of the text field with window
So now when the tab with scroll view=>text field is selected I can resize the window - no problems. However, when I activate the other tab, resize the window and then activate my tab with the scroll view - the autolayout complains with a similar message as I reported earlier. In fact the same happens if only leading and trailing constraint is set up.
Could anyone try to reproduce it?