Thank you so much for this Roland,
> On 5 Sep 2015, at 14:11, Roland King <r...@rols.org> wrote: > > This reminds me of the discussion we had about putting stack views in > scrollviews back in January > > http://lists.apple.com/archives/cocoa-dev/2015/Jan/msg00092.html > > it certainly took a bit of messing about but it wasn’t that hard in the end. > Ken reminded me in that thread about the embed in scrollview which removed > one useless window I didn’t need. You added 4 constraints to the scrollview > and 3 to the stackview, and flipped the window. XCode 6.4, Mac OS X 10.10. I’m looking at it now, I deleted everything in the NIB and started again clean. I then Added a Window, Added a Scroll View, set the Clip view class to FlippedClipView. I then did as you suggested on the link, I created a new StackView, selected it and did “Embed in Scroll View’ in the Editor Menu. This gave the following View Layout: Window MainView NSScrollView FlippedClipView StackView (vertical) Scroller Scroller I selected the Window and then “Reset to Suggested Constraints”. This added the constraints as so: Window MainView NSScrollView FlippedClipView StackView (vertical) Constraints Horizontal Space - FirstItem: StackView.Leading Relation:Equal Second Item: FlippedClipView.Leading Constant: 0 Priority:1000 Multiplier: 1 Vertical Space - FirstItem: FlippedClipView.Bottom Relation:Equal Second Item: StackView.Bottom Constant: 0 Priority:1000 Multiplier: 1 Horizontal Space - FirstItem: FlippedClipView.Trailing Relation:Equal Second Item: SuperView.Trailing Constant: -1 Priority:1000 Multiplier: 1 Vertical Space - FirstItem: StackView.Leading.Top Relation:Equal Second Item: FlippedClipView.Top Constant: -1 Priority:1000 Multiplier: 1 Scroller Scroller Constraints Horizontal Space - FirstItem: MainView.Trailing Relation:Equal Second Item: NSScrollView.Trailing Constant: standard Priority:1000 Multiplier: 1 Horizontal Space - FirstItem: NSScrollView.Leading Relation:Equal Second Item: MainView.Leading Constant: standard Priority:1000 Multiplier: 1 Vertical Space - FirstItem: NSScrollView.Top Relation:Equal Second Item: MainView.Top Constant: 0 Priority:1000 Multiplier: 1 Vertical Space - FirstItem: MainView.Bottom Relation:Equal Second Item: NSScrollView.Bottom Constant: standard Priority:1000 Multiplier: 1 Which one of these do I remove? pValidationIssueScrollView is an Outlet to the NSScrollView. pValidationListStackView is an Outlet to the StackView Also do I add the “DetailView’s” to the StackView or to the ScrollView? Given the above and the following code: -(void) awakeFromNib { NSClipView* myContentView; NSView* myDocumentView; NSView* myDetailView; NSButton* myButton; NSInteger myIndex; myContentView = self.pValidationIssueScrollView.contentView; myDocumentView = self.pValidationIssueScrollView.documentView; for (myIndex = 0;myIndex < 100;myIndex++) { myDetailView = [[NSView alloc] initWithFrame:(NSMakeRect(0,0,200,100))]; myButton = [[NSButton alloc] initWithFrame:NSMakeRect(0,0,20,20)]; [myButton setButtonType:NSMomentaryPushInButton]; [myButton setBezelStyle:NSRoundedDisclosureBezelStyle]; [myButton setBordered:YES]; [myDetailView addSubview:myButton]; // [self.pValidationIssueScrollView addSubview:myButton]; [self.pValidationListStackView addView:myDetailView inGravity:NSStackViewGravityTop]; } [self validationSetupStackView]; } This results in all the Views landing on top of each other in the StackView. Also I get this in the log on the second view added onwards: 2015-09-05 16:54:03.480 LTWALTest1[1252:412890] Unable to simultaneously satisfy constraints: ( "<NSLayoutConstraint:0x608000081360 V:[NSStackViewSpacer:0x638000180820(>=20)]>", "<NSLayoutConstraint:0x608000081900 V:[NSView:0x638000120140]-(0)-[NSStackViewSpacer:0x638000180820]>", "<NSLayoutConstraint:0x608000081e50 V:[NSStackViewSpacer:0x638000180820]-(0)-[NSView:0x6380001201e0]>", "<NSAutoresizingMaskLayoutConstraint:0x6080000810e0 h=--& v=--& V:[NSView:0x638000120140]-(0)-| (Names: '|':NSStackViewContainer:0x6200001a02a0 )>", "<NSAutoresizingMaskLayoutConstraint:0x608000081720 h=--& v=--& V:[NSView:0x6380001201e0]-(0)-| (Names: '|':NSStackViewContainer:0x6200001a02a0 )>", "<NSAutoresizingMaskLayoutConstraint:0x608000081770 h=--& v=--& V:[NSView:0x6380001201e0(100)]>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x608000081360 V:[NSStackViewSpacer:0x638000180820(>=20)]> Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or, break on objc_exception_throw to catch this in the debugger. 2015-09-05 16:54:03.481 LTWALTest1[1252:412890] Unable to simultaneously satisfy constraints: ( "<NSLayoutConstraint:0x608000081900 V:[NSView:0x638000120140]-(0)-[NSStackViewSpacer:0x638000180820]>", "<NSLayoutConstraint:0x608000081e50 V:[NSStackViewSpacer:0x638000180820]-(0)-[NSView:0x6380001201e0]>", "<NSAutoresizingMaskLayoutConstraint:0x6080000810e0 h=--& v=--& V:[NSView:0x638000120140]-(0)-| (Names: '|':NSStackViewContainer:0x6200001a02a0 )>", "<NSAutoresizingMaskLayoutConstraint:0x608000081720 h=--& v=--& V:[NSView:0x6380001201e0]-(0)-| (Names: '|':NSStackViewContainer:0x6200001a02a0 )>", "<NSAutoresizingMaskLayoutConstraint:0x608000081770 h=--& v=--& V:[NSView:0x6380001201e0(100)]>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x608000081e50 V:[NSStackViewSpacer:0x638000180820]-(0)-[NSView:0x6380001201e0]> Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or, break on objc_exception_throw to catch this in the debugger. Thanks Dave _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com