layer hit test only returning layer when bottom half of layer is touched

后端 未结 8 1978
闹比i
闹比i 2021-02-10 19:14

I have a sublayer on a layer-backed view. The sublayer\'s contents are set to an Image Ref and is a 25x25 rect.
I perform a hit test on the super layer when the touchesBega

8条回答
  •  误落风尘
    2021-02-10 19:28

    I have simplified my code to find the problem. I only have one sublayer on screen and no subviews. The code listed above is what I am running in the simulator. Since there are only 2 layers on screen, the backing layer of the host view and the sublayer I have added, nothing should interfere with the hit test.

    In case it wasn't clear, when the top portion of the sublayer is touched, the hit test return the backing layer instead. Also if I touch the backing layer at a point just below the sublayer, the sublayer is returned by the hit test.

    It is hard to explain but if you run the code, it becomes clear.

    Thanks

提交回复
热议问题