进行可能是一个办法:
- 创建CAKeyframeAnimation
- 定义要使用一组CATransform3D的对象
- 这些转换添加到动画中实现缩放和旋转的关键帧动画
- 发送
addAnimation
消息到您的标签图层对象:[[label layer] addAnimation]
;
这里是假设yourLabel
代码示例是UILabel
要缩放和旋转:
CAKeyframeAnimation *scale = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
CATransform3D scaleUp = CATransform3DMakeScale(1.5, 1.5, 1); // Scale in x and y
CATransform3D rotationScaled = CATransform3DRotate (scaleUp, 90, 0, 0, 1); // Rotate the scaled font
[scale setValues:[NSArray arrayWithObjects:
[NSValue valueWithCATransform3D:CATransform3DIdentity],
[NSValue valueWithCATransform3D:rotationScaled],
nil]];
// set the duration
[scale setDuration: 1.0];
// animate your label layer
[[yourLabel layer] addAnimation:scale forKey:@"scaleText"];
这通常是怎样蹦跳着文本将动画的实例。
当设备开始旋转并在旋转完成时检索动画时,您可以开始此操作,以便您可以使用正确的比例/位置更新标签。
您需要进行调整才能找到合适的时间和旋转。
你是否设法实现你想要做的事情?你能接受其中一个答案来解决这个问题吗? – MiKL 2011-03-24 08:27:01