Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone - Touch event is not received by UIImageView while animating using CABasicAnimation
    text
    copied!<p>i Have a UIImageview object moving along a path and i have use CABasic animation and BezierCure to move the object along the path, Now the problem is if i touch the moving object the touch event is not recognized by the UIImageView but the touch event is received by main view. can anybody help me to solve this problem? Below is my code</p> <pre><code>UITouch *touch = [[event allTouches] anyObject]; if (![touch.view isEqual: beaconPose1]) { return; } [touch.view.layer removeAllAnimations]; CGPoint location = [touch locationInView: self.view]; CGRect frame = touch.view.frame; frame.origin.x = location.x; frame.origin.y = location.y; ///frame.origin.x += xDisplacement; //frame.origin.y += yDisplacement; touch.view.frame = frame; </code></pre> <p>-- Code where User Interaction is enabled</p> <pre><code>[beaconPose1 setUserInteractionEnabled:true]; CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; pathAnimation.duration = 1.0f; pathAnimation.path = beaconPose3Path.CGPath; pathAnimation.calculationMode = kCAAnimationLinear; CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; fullRotation.fromValue = [NSNumber numberWithFloat:0]; fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)]; fullRotation.duration = pathAnimation.duration; fullRotation.repeatCount = pathAnimation.duration/fullRotation.duration; [beaconPose1.layer addAnimation:fullRotation forKey:@"360"]; [beaconPose1.layer addAnimation:pathAnimation forKey:@"movingAnimation"]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload