I have the following setup :
- Blue background at zPosition = 0
- Yellow button at zPosition = 0 with an action to print "Button tapped"
- UIView with grey background and 0.8 alpha at zPosition = 1 with a UITapGestureRecognizer with an action to print "Grey view tapped"
When I tapped at the grey area, "Grey view tapped" is printed. But if I tapped at the location of the yellow button, "Button tapped" is printed. I expected to always have printed "Grey view tapped" because that view is in front of the button. How can I prevent the button that is behind a view to be triggered ?
I know that I can set the button to .isEnabled = false but that is not a suitable solution since the grey background is created in a parent view controller from witch all my views are inheriting.
I set the grey view to .isUserInteractionEnabled = true
(even if it's the default value) as stated here : In Stackoverflow
I thought using Apple Documentation but the problem is that there are a button and a gesture recognizer instead of multiple gesture recognizers.
Any idea on how to do this properly?