I had one UIView (blue) and I want to detect on it gestures recognizers. I would like to catch Pan and Tap gesture on this view , but when user tap on this view, I want "deliver" this touch/tap to parent view (green).
My blue UIView:
class SwipeView: UIView, UIGestureRecognizerDelegate {
var tap: UITapGestureRecognizer!
var pan: UIPanGestureRecognizer!
func setup() {
tap = UITapGestureRecognizer(target: self, action: #selector(Swipe.onTap))
tap.delegate = self
tap.enabled = true
self.addGestureRecognizer(tap)
pan = UIPanGestureRecognizer(target: self, action: #selector(Swipe.onPan))
pan.delegate = self
pan.enabled = true
self.addGestureRecognizer(pan)
self.backgroundColor = .blueColor()
}
func onTap() {
}
func onPan() {
}
override func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
return false
}
}
Even if I return gestureRecognizerShouldBegin = false green UIView not catch any event. So, how can I do this functionally? Thx for help.
Deliver to parent like so: