I have the following setup.
+- XXXCustomControl : UIControl -------+
| A |
| +- ContentView -------------------+|
| |
If you want to handle the event from superview(XXXCustomControl in your case) instead of inner view(ContentView in your case), you can write the following swift code in your superview:
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let view = super.hitTest(point, with: event) else { return nil }
if view.isDescendant(of: self) {
// your custom logic
}
return view
}