私は(移動)このようなサブクラスUIImageViewアニメーション:すべて動作することをUIViewをアニメーション化する - 位置を追跡する方法は?
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"];
:その後、
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 1];
[UIView setAnimationDelay:0];
[UIView setAnimationCurve: UIViewAnimationCurveEaseOut];
[UIView setAnimationBeginsFromCurrentState:YES];
if (position == 0) position = 1;
if (position > 6) position--;
self.transform = CGAffineTransformMakeTranslation(position*120, 0);
[UIView commitAnimations];
は、私はそれが脈動させてそれを強調表示します。それは120ピクセルで移動しますが、コールしたときに脈動したコードは、元の位置に脈動します。それはなぜですか、私はそれをどのように変更できますか?
tobias
最終的にそれを手に入れました!ありがとう!それを[self setFrame:CGRectMake(30 + position * 120、self.frame.origin.y、self.frame.size.width、self.frame.size.height)]に変更しました。 –
問題ありません!お力になれて、嬉しいです! – David