I am trying to implement a graph that draws uiview. There are 3 UIViews for animating the left / right slide. The problem is that I cannot cancel the UIView animation. So I replaced UIViews with CALayer. Now the question is, is CALayer suitable for this? Is it ok to draw on CALayer like this? And why is CALayer so slow when I manage the properties of the frame.
CGRect frame = curve.frame;
frame.origin.x -= diffX;
[curve setFrame:frame];
Is there an alternative?
PS I'm a German guy. Sorry for mistakes.
I got the animation with CATransaction, but now I will animate the x movement with CABasicAnimation. To avoid problems, expect the position of the layer to return to the previous x.
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
theAnimation.delegate = self;
theAnimation.duration = 1.0;
theAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
CGPoint position = [[curves objectAtIndex:i]position];
position.x = [[curves objectAtIndex:i]position].x - diffX;
[theAnimation setToValue:[NSValue valueWithCGPoint:position]];
[[curves objectAtIndex:i] addAnimation:theAnimation forKey:[NSString stringWithFormat: @"translate.x.%d", index]];
(, xStart = 100, xEnd = 200), , x (, x = 100).
? , ?
removeOnComplete, .
.