I have a UIScrollView all hooked up in Storyboard and I have several subviews. When the scrollview gets to my StackView > Container View when I try to scroll vertically up or down when touching this view the UIScrollView seems to stop responding to touch events. As a test I disabled userInteraction on my stackview > container view and when this is disabled scrolling works as intended. The problem is if I disable userInteraction on my subview which has a button inside its containerView the button then stops working (as user interaction is disabled). Whats the best way to handle this scenario and why is my container view stopping the scrolling?
Asked
Active
Viewed 224 times
1 Answers
0
you can solve this issue with constraint only, with following steps:
- Set the constraints: Leading, Trailing, Top & Bottom should be equal to the ones from UIScrollView
- Set up an equal Width constraint between the UIStackView and UIScrollView.
- Set Axis = Vertical,Alignment = Fill, Distribution = Equal Spacing, and Spacing = 0 on the UIStackView
More detail you can visit reference answer.

iOS Developer
- 538
- 4
- 10
-
I am not sure how this will make any difference. My scrollview does scroll its just when the subview is in view and I touch this subview to scroll it doesn't. If i scroll just above or below or 2 the sides of the subview it does behave correctly? – Alex McPherson Feb 21 '18 at 15:59
-
Please check this [Example](https://useyourloaf.com/blog/scrolling-stack-views/) as they have stack view in UIScrollView. – iOS Developer Feb 22 '18 at 11:17