Question

I have a UIViewController, on top I put an UIImageView, then a UIScrollView.

I can process touches on the UIScrollView just fine, however I want to process certain touches on the UIViewController.

I only need touches on the UIScrollView that are held for 5 seconds (This part works fine). Anything less than that I want to pass to the UIViewController.

On the UISCrollView I call this:

- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
// some custom code to process a specific touch.

// all other touches
    [super touchesBegan: touches withEvent: event];
}

Is there a way to pass touches from the UIScrollView to the bottom UIViewController, or do I have to pass a references to the UIViewController into the UIScrollView?

Was it helpful?

Solution

Solved!

Needed to add:

[self.nextResponder touchesEnded: touches withEvent:event]; 

to the top most controller.

Thank you to myself!

OTHER TIPS

touchesBegan description in the Apple Documentation tells:

To forward the message to the next responder, send the message to super (the superclass implementation); do not send the message directly to the next responder. For example,

[super touchesBegan:touches withEvent:event];

If you override this method without calling super (a common use pattern), you must also override the other methods for handling touch events, if only as stub (empty) implementations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top