I have 1 Main View and 1 SubView:
Main View > SubView
I think that the Main View is "stealing" the events from the SubView.
For example, when I tap on the SubView, only the Main View GestureRecognizer is fire.
Here is my custom GestureRecognizer (which intercepts every touch event):
import UIKit
import UIKit.UIGestureRecognizerSubclass
class MainGestureRecognizer: UIGestureRecognizer {
override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
super.touchesBegan(touches, withEvent: event);
//nextResponder() ??
state = UIGestureRecognizerState.Began;
}
override func touchesMoved(touches: NSSet!, withEvent event: UIEvent!) {
super.touchesMoved(touches, withEvent: event);
//nextResponder() ??
state = UIGestureRecognizerState.Changed;
}
override func touchesEnded(touches: NSSet!, withEvent event: UIEvent!) {
super.touchesEnded(touches, withEvent: event);
//nextResponder() ??
state = UIGestureRecognizerState.Ended;
}
override func touchesCancelled(touches: NSSet!, withEvent event: UIEvent!) {
super.touchesCancelled(touches, withEvent: event);
//nextResponder() ??
state = UIGestureRecognizerState.Cancelled;
}
}
Maybe I should use nextResponder, but I have only found Obj-C code like:
[self.nextResponder touchesBegan:touches withEvent:event];
What's the trick to pass an event to the next responder in the responder chain?
Is there a way to pass touches through on the iPhone?
So the question is, what should I do to make the second event (the SubView Event) fire too?
Is there a function like nextResponder in Swift?
Ôh ! Here is the Swift code for nextResponder :
https://stackoverflow.com/a/26510277/4135158
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