Similar questions have been asked to this, but my predicament is actually the opposite of theirs. I've got a fullscreen, paging UIScrollView
, with each page being the size of the screen. Inside of that, I've got some pages that are themselves UIScrollViews
, with their width greater than the screen width. The inner scrollviews are within a few layers of other UIViews
, they are not direct subviews of the outer scrollview.
What I'd like is that, when I get to the end of one of the inner scrollviews, it starts scrolling the outer scrollview. From other questions I see on here, it looks like that should happen, but for some reason it doesn't. What in my setup could be causing this to stop happening? Where in the touch stack is the hand-off supposed to happen between inner and outer scrolling?
edit: Is there any way to pass touches or pan gesture commands out to the outer scroll view using I sense the inner view is past its bounds via scrollViewDidScroll
delegate method?
Placing multiple scroll views into a common container scroll view is actually pretty straightforward: Create a UIScrollView that acts as the container view for the inner scroll views. Add the inner scroll views to the container view. These can be plain scroll views or table/collection views.
UIScrollView is the superclass of several UIKit classes, including UITableView and UITextView. A scroll view is a view with an origin that’s adjustable over the content view. It clips the content to its frame, which generally (but not necessarily) coincides with that of the application’s main window.
These constraints tell the UIScrollView the boundaries of your content (sets the contentSize of the UIScrollView ). You usually only want your content to scroll in one direction. In my case, I want the scroll view to scroll vertically. Therefore, I need to set the width of my single content view to be the width of the scroll view.
A view that allows the scrolling and zooming of its contained views. UIScrollView is the superclass of several UIKit classes, including UITableView and UITextView. A scroll view is a view with an origin that’s adjustable over the content view.
You can call the super class touchesBegan delegate as follows
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
}
Here is the reference link: How to pass the touch event to superview when userInteractionEnabled = YES?
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