-1

Well I have made a UIView subclass. Inside it a have placed a UIScrollView object that has a circular shape and contains a uiviewimage. I have also placed CAShapeLayer that has a circular shape. the CAShapeLayer is above the UIScrollView and is overlapping a little. I want to be able to detect tap when I touch the CAShapeLayer and still be able to scroll inside the UIScrollView when I want. The problem is some area of the CAShapeLayer can not detect tap, but I want to detect the whole object even though it place above the UIScrollView because it is overlapping a little on the right side.

For better understanding please look at this picture: enter image description here

The problem is I don't know how to fix that, please show me with code how to do that...

Peppo
  • 1,107
  • 1
  • 12
  • 19
  • 5
    Layers don't detect events; they aren't UIResponders. I think you'll need to create a UIView subclass that uses a CAShapeLayer as its layer class. You can find numerous examples and tutorials via your favorite search engine. – Avi Dec 03 '15 at 13:27
  • can you point me to some code to try out?? – henerik larsen Dec 03 '15 at 13:33
  • if you want i can even pay you – henerik larsen Dec 03 '15 at 13:33
  • https://maniacdev.com/2013/08/uiview-subclass-backed-by-cashapelayer-that-makes-creating-custom-shapes-and-animations-easier – Avi Dec 03 '15 at 13:39

1 Answers1

0

You can add tap gesture recognizer on view containing the layer and then detect if layer's frame contains the tap point

Frane Poljak
  • 2,315
  • 23
  • 25