I have the following setup.
+- XXXCustomControl : UIControl -------+
| A |
| +- ContentView -------------------+|
| | ||
| | B ||
| | ||
| +---------------------------------+|
+--------------------------------------+
A XXXCustomControl that is a subclass of UIControl. It contains one subview called contentView of type UIView with size that is smaller than the Control's area..
That view has .userInteractionEnabled = YES
;
I need that property to have set to YES, because horizontal scrollviews are put inside this once in a while and they need to be scrollable. If the superview (in our case content view would not allow user interaction, this is inherited y the subviews.)
But at the same time this XXXCustomControl
need to be tappable when it contains no scrollview in its content view not only in area A but also in area B.
So I have a "conflict of interests" here because I either
1) set the content view to userInteractionEnabled = NO
, then I can tap the empty control in the content view area both in A and B, but the scrollviews I will put there won't be scrollable..
2) set the content view to userInteractionEnabled = YES
but then, if the Control s empty, I can only tap area A to trigger a touch event.
One idea I came up with is that I set the property to NO by default and when I populate the contentView I set it to yes. when I clear the contentView I set the property back to no. Basically I want this to have set to yes all the time, and when it is empty ,force the contentView to pass the touchUpInside event up to its superview.
Is this possible?