Search code examples
iphoneiosobjective-cuiviewimage-masking

UIViews-masked-off-area-still-touchable


Masked image

I have Masked UIView . View with blue dots. Green circle Area is masked off.I dont want to get touches on that area.i just want to get touches on visible layer of the View.


Solution

  • Try creating a CGPath of the masked area & then check if the touch falls in ur masked area or not like this :

    UIBezierPath *p = [UIBezierPath bezierPathWithCGPath:myCGPath];

    BOOL isInPath = [p containsPoint:myCGPoint];

    Hope this Helps !!!