I have a scroll view that is 256x256 in width/height. I have subviews of that scroll view stretching in both directions (left and right). I set clipToBounds to NO so I can see the items in the scroll view.
When the user touches a space in the scrollview holder (the area that extends beyond the 256x256) I check the hittest and return the scrollView.
My problem is the items on my scrollview are buttons, and if the button is not inside the 256x256 it is not receiving the touch events. How do I cycle through the buttons on the scrollview and then forward the events to the buttons?
I'm doing like this Paging UIScrollView with peeking neighbor pages
But my scrollview subviews aren't receiving events.
I've tried all of the following in my view that is supposed to send events down the wire and my buttons will not receive the events. The event chain always stops at my UIScroll view - allowing me to scroll my items - but how do I forward events to the buttons from the scrollview?
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([self pointInside:point withEvent:event]) {
return self.scrollView;
}
return nil;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([self pointInside:point withEvent:event]) {
return self.scrollView;
}
return nil;
}
- (UIView *) hitTest:(CGPoint) point withEvent:(UIEvent *)event {
UIView* child = nil;
if ((child = [super hitTest:point withEvent:event]) == self) {
return self.scrollView;
}
return child;
}
