進行可能是一個辦法:
- 創建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