User Interaction Enabled With CAAnimation?

后端 未结 2 1002
春和景丽
春和景丽 2021-01-22 16:29

It is very easy to allow users to interact with views while animating using the options field of block based animation. But in my program I am using a CAKeyframeAnimation and I

2条回答
  •  感情败类
    2021-01-22 16:37

    You are most likely touching the wrong place. When the layer animates on screen the value never changes so the view is actually positioned where it was from the beginning, not where it appears on screen.

    I did a blog post a few month ago on how to hit test animating layers. It describes the exact thing that you are trying to do.

    You will need to add the touch handling (or gesture recognizer) to the superview and do the hit-testing of the presentationLayer yourself to determine if the user tapped where the view appeared on screen.

提交回复
热议问题