Note that there are some explanatory texts on larger screens.

plurals
  1. POAnimating UIView - How to keep track of Position?
    text
    copied!<p>i animate (move) a subclassed UIImageView like this:</p> <pre><code>[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 1]; [UIView setAnimationDelay:0]; [UIView setAnimationCurve: UIViewAnimationCurveEaseOut]; [UIView setAnimationBeginsFromCurrentState:YES]; if (position == 0) position = 1; if (position &gt; 6) position--; self.transform = CGAffineTransformMakeTranslation(position*120, 0); [UIView commitAnimations]; </code></pre> <p>then, i want to highlight it by let it pulsate:</p> <pre><code>CAKeyframeAnimation *bounce = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; CATransform3D forward = CATransform3DMakeScale(1.3, 1.3, 1); CATransform3D back = CATransform3DMakeScale(0.7, 0.7, 1); CATransform3D forward2 = CATransform3DMakeScale(1.2, 1.2, 1); CATransform3D back2 = CATransform3DMakeScale(0.9, 0.9, 1); [bounce setValues:[NSArray arrayWithObjects: [NSValue valueWithCATransform3D:CATransform3DIdentity], [NSValue valueWithCATransform3D:forward], [NSValue valueWithCATransform3D:back], [NSValue valueWithCATransform3D:forward2], [NSValue valueWithCATransform3D:back2], [NSValue valueWithCATransform3D:CATransform3DIdentity], nil]]; [bounce setDuration:0.6]; [[super layer] addAnimation:bounce forKey:@"bounceanimation"]; </code></pre> <p>That all works. It's get moved by 120 Pixel but when a call the pulsate code it will pulsate on its original position, not where i've just moved it. why is that and how can i change it?</p> <p>tobias</p>
 

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