Note: I already read some questions about the UIScrollView
sending touches to the subviews (this included and although I have up voted, it's not working as I intended anymore).
What I have: I have a UIScrollView
with a Custom UIView
(let's call it A) inside which covers the entire UIScrollView
. I am also allowed to put other custom UIViews
inside the A.
On the code I am doing this:
[scrollView setDelaysContentTouches:YES];
scrollView.canCancelContentTouches = NO;
What is happening: At the moment my only issue is that, if I want to move a subview inside A, I have to touch it, wait, and then move it. Exactly as stated here:
Now, the behaviour changes depending on the "length in time" of the first touch on the UIView. If it's short, then the relative dragging is managed as it was a scroll for the UIScrollView. If it's long, then I'm getting the touchesMoved: events inside my UIView.
What I want: The subviews inside A should always receive priority and I shouldn't have to touch and wait. If I touch A and not a subview of it, I want the UIScrollView
to receive the touches, like panning and moving around (the contentSize
is bigger than the frame
).
Edit 1.0
The only reason for me to have this A view inside a generic UIScrollView
, is because I want to be able to zoom in/out on the A view. So I am doing the following:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return customView; // this is the A view
}
In the beginning I didn't had the A view inside the UIScrollView
and the only thing I did was adding the A as a subView of my UIViewController's
root view and everything went well. If there is another way to enable zoom in/out I will gladly accept the answer.
hitTest
? herbert-siojo.com/2011/04/01/… – A-Live