【问题标题】:How to transform (rotate) a already exist CALayer/animation?如何转换(旋转)已经存在的 CALayer/动画?
【发布时间】:2011-02-02 18:12:01
【问题描述】:

我在我的应用的 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 而不是我设置的动画/图层。

【问题讨论】:

    标签: iphone uiview transform calayer


    【解决方案1】:

    这个错误是因为 CALayer 的变换属性的类型是 CATransform3D,你给它一个 CGAffineTransform。采用 CATransform3D CATransform3DMakeRotation (CGFloat angle, CGFloat x, CGFloat y, CGFloat z); 而是。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-26
      • 1970-01-01
      • 1970-01-01
      • 2018-02-05
      • 1970-01-01
      • 2013-10-26
      • 2014-07-18
      相关资源
      最近更新 更多