forcewill
forcewill

Reputation: 1647

NSScrollview autolayout issue

I have an NSScrollview which contains two views, lets call them View A and View B respectively, now both of them can grow in height, i want that View A appears at the top and View B at bottom and that when the height of the two combined is greater than the NSScrollView clip view i want to be able to scroll as usual

I just can't seem to get the AutoLayout constraints correct for this behaviour im using Masonry anyone has had the same issue/dificulty with AutoLayout and NSSCrollView and can point me in the right path ?

Upvotes: 0

Views: 584

Answers (1)

Pierre Bernard
Pierre Bernard

Reputation: 3198

I have recently experimented with shoehorning two table views into a single scroll view. My set up had a scroll view with a clip view. Within that a custom view. Within that I have the two growing views. Constraints have the the custom view grow with the two child views.

One thing I noticed: If you set up your own scroll view, you need to create constraints to tie your view to the clip view it is in. I had to set up constraints to pin the my custom view to the top, left and right of the clip view. If I add a fourth constraint to pin the bottom to the clip view, the scroll view actually grows with my own content view.

Sample project: https://dl.dropboxusercontent.com/u/2381634/SO/GrowingViews.zip

Upvotes: 2

Related Questions