I haven't tried that yet, but I assume that I would have to disable scrolling of the parent scroll view as soon as I know that the user will want to scroll in the child scroll view, right?
Both scroll views are scrolling horizontal.
How could I disable scrolling detection of the parent temporarily? Or is there some other way?
UIScrollView has a property called scrollEnabled
, which you can set to NO
to disable scrolling in your parent scroll view.
I haven't tried it yet, but you may just find that it Does The Right Thing, i.e., the inner scroll view scrolls until it can't scroll any more, at which point the outer scroll view scrolls.
It is very possible. The easiest way is to disable the scrollEnabled
property, you can also try set the outer UIScrollView
's contentSize
to its bounds, so that it won't scroll. Depending on what you need, you may set No to bounce
as well but that'll basically make your scroll view like a regular UIView.
If you have control over all the child UIScrollView
's, you can implement UIScrollViewDelegate
protocol, but if you don't, or your child UIScrollView
is really a UITableView
, or UICollectionView
, then you can't really rely the UIScrollViewDelegate
protocol, but remember UIScrollView
comes with a panGestureRecognizer
and you can play with that. A powerful but heavy handed way is to add an observer on the panGestureRecognizer
's state
property so that you can capture all the events without being the delegate of the UIScrollView
in question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With