Auto layout and scroll views on OS X
Auto layout and scroll views on OS X
- Subject: Auto layout and scroll views on OS X
- From: Allison Newman <email@hidden>
- Date: Tue, 22 Jul 2014 13:02:31 +0200
I have a simple application (zipped project can be found here: http://phonicnoise.com/UIsandbox.zip ) that generates two rows of square buttons. The number of buttons is generated dynamically based on model data. The buttons plus spacing should take up the entire vertical space of their parent view, and the width adjusts accordingly (as buttons need to remain square, if you increase their height, the width has to increase as well).
Anyway, the application works just fine if I add the content directly into a window - resizing the window resizes the buttons. But if I try to create a scrollview that takes up all of the window, and then place the content in the scroll view, nothing is drawn. Instead I get the following error message:
2014-07-21 12:29:33.382 UI sandbox[14370:2640458] Failed to set (contentViewController) user defined inspected property on (NSWindow): Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:<NSLayoutConstraint:0x6080000832f0 V:|-(0)-[NSView:0x608000120d20] (Names: '|':NSClipView:0x1002077f0 )> view:<NSView: 0x608000120d20>
I have read the Auto layout programming guide,, and in particular the section concerning scrollviews, and I also looked up this tech note (https://developer.apple.com/library/ios/technotes/tn2154/_index.html) but neither really shed much light on the problem for me, and I didn’t find anything useful searching back through the history of cocoadev…
In the project code, I have a define that can be activated to switch between the scrollview / no scrollview configurations: PN_USING_SCROLLVIEW.
If anyone can point me in the right direction for sorting this out, that would be much appreciated!
Allison
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden