【发布时间】:2013-06-25 13:29:23
【问题描述】:
我正在编写一个抖动图像功能,代码如下:
CABasicAnimation* shake = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
shake.fromValue = [NSNumber numberWithFloat:-0.2];
shake.toValue = [NSNumber numberWithFloat:+0.2];
shake.duration = 0.1;
shake.autoreverses = YES;
shake.repeatCount = 4;
[self.imageView.layer addAnimation:shake forKey:@"imageView"];
self.imageView.alpha = 1.0;
[UIView animateWithDuration:2.0 delay:2.0 options:UIViewAnimationOptionCurveEaseIn animations:nil completion:nil];
我有两个问题:
1.上面的代码会围绕中心晃动图像(transform.rotation.z)。但是如何让图像围绕底部中心晃动呢?
2.如何控制这个抖动动画的开始和停止?例如,使图像抖动,直到从服务器获取数据完成然后停止动画。
【问题讨论】: