Say, I have a UIView with some controls on it. After I set its layer.mask which is smaller than view’s bounds. Those invisible controls on the view can still be touched and respond. This is not expected by me.
Is there anything I missed, or any simple method to make masked-off controls untouchable?
Thank you!
Masks and even transforms through CIFilters (iOS 5) only modify what you can see, not the area that you can touch. For that you need to override the
hitTest:withEvent:and account for the image mask. You might have success by using[[[self layer] presentationLayer] hitTest:aPoint]or[[[self layer] mask] hitTest:aPoint]in your overridden-[UIView hitTest:withEvent:]