After Xcode 11, I can not set the UIScrollView constraint inside another UIScrollView.
I have a parent scrollView & a child scrollView.
parent scrollView is the parent of all elements in the page & can scroll vertical if the contents height gets taller than the screen.
On very top of contents, I have a horizontal photo slider (I use Auk) which is another scrollView.
Before the Xcode 11, I set the constraints like this & there was no problem:
For the parent scrollView:
- connect top, bottom, left, right constraint to the superView(safe area)
- equal the with of parentScrollView to the superView(view) to block horizontal scroll
For the child scrollView:
- connect top, bottom, left, right constraint to the superView(parent scrollView)
- equal the with of childScrollView to the superView(parentScrollView)
- setAspectRation to 16:9 (for adjusting the height of child scrollView relative to its width)
But I get ambiguous height & width error on interfaceBuilder for the child scrollView
Also I turned off the 'Content Layout Guide' for both scrollViews
I saw this famous question here but it did not helped as well.
The app runs perfect as I expected, but there are some warnings on the console which I don't like to see...
In my opinion, most of the similar questions on Stack Overflow are about elements in scrollView, mine is for Xcode 11+ & scrollView inside scrollView.
I added the demo project, you can download it from here.