I've set a UITapGestureRecognizer on a view. Only specific areas within the view need to trigger the view's behavior. I do that by checking whether the exact location of the touch is on actual actionable areas in the view. In cases where the touch is not in these areas, I'd like the tap to propagate upwards in the view hierarchy.
I've tried to use the gesture delegate: shouldReceive touch, and test there if the touch is relevant to the view, but I cannot perform the action there, as it fires on touch, not on tap. I could just perform the relevancy test in shouldReceive, and only if the tap action handler gets called perform the action, but I find it awkward. Is there a more elegant way to tell iOS that my gesture recognizer decided not to consume the tap?
gestureRecognizer: shouldReceiveRouch
would have been right way. But with attributed strings, for non-trivial use-cases, you should rely on Text Kit. Without looking at any code, I can only suggest to examine this particular answer, will be helpful: stackoverflow.com/a/28519273/3339346 – ystackif-else
around the gesture location point in view calculations to achieve this? – ystack