views:

1653

answers:

0

I have a view derived from a UIScrollView controller that I use to page through images in a library. That works fine.

I overlayed a UIView on the right side to handle touches for scrolling quickly through the list of images. My problem is that if I pass the touches through to either 'super' or 'nextResponder' they never make it to the UIScrollView object below.

My question is how can I force the UIScrollView below to handle the touches that I don't need to handle? I'm setting a timer for 0.3 seconds that during that time all touches are passed to the UIScrollView to handle. So if the user started a swipe gesture to turn the page, it will happen.

Here's the code for the touchesBegan method:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];

// Start a timer to trigger the display of the slider and the processing of events.
touchesTimer = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(showSlider:) userInfo:nil repeats:NO];

// Where are we at right now?
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
lastPage = [self page:currentPoint.y];

// Pass the event though until we need it.
//  [self.nextResponder touchesBegan:touches withEvent:event];
if ([touch.view isKindOfClass:[UIScrollView class]]) 
{
 if (self.nextResponder != nil &&
  [self.nextResponder respondsToSelector:@selector(touchesEnded:withEvent:)]) 
 {
  [self.nextResponder touchesEnded:touches withEvent:event];
 }
}
}