Question

My ImageView rotates but while it rotates it doesn't recognize touches on itself. Do you think it's okay if I create a button via code that's over the ImageView that recognizes the touch?

Was it helpful?

Solution

When an animation is applied on any UIView or any subclass object of a UIView like UIImageView, UIButton etc then it does not detect touch events because when an animation is applied to a view, the animated property changes to its end value right away. what you are actually seeing on screen is the presentation layer of your views layer.

To answer your question, Yes, you can make a UIButton that covers up the area of the UIImageView to detect touch events on it. That sounds like the easiest to implement option in this case.

Apart from that, this link may also help you in the process. Hit testing animating layers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top