[英]How to transform (rotate) a already exist CALayer/animation?
我在我的應用程序的UIView中添加了一個CALayer:
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.35];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
animation.type = @"pageCurl";
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 0.58;
[animation setRemovedOnCompletion:NO];
[[self.view layer] addAnimation:animation forKey:@"pageCurlAnimation"];
現在,當用戶旋轉設備時,圖層始終保持在屏幕上的相同位置(與主屏幕按鈕對齊)。 是否可以旋轉動畫/圖層? 我試過了
self.view.layer.transform = CGAffineTransformMakeRotation (angle);
但是這段代碼只是旋轉UIView而不是我設置的動畫/圖層。
錯誤是因為CALayer的transform屬性的類型是CATransform3D,並且你給它一個CGAffineTransform。 使用CATransform3D CATransform3DMakeRotation(CGFloat角度,CGFloat x,CGFloat y,CGFloat z); 代替。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.