Applying multiple transforms to a UIView / CALayer

前端 未结 4 513
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 17:29

Is there any problem applying multiple transforms to a UIView and it\'s corresponding CALayer?

Specifically, can you \"mix and match\" CATransform3Ds with CGAffineTr

4条回答
  •  一生所求
    2020-12-05 17:54

    pix0r is right but here is some more info on this. The official docs for CGAffineTransformConcat().

    Also, here is a quick example:

    // Rotate 45 degrees
    CGAffineTransform rotate = CGAffineTransformMakeRotation(45*(M_PI/180));
    // Move to the left
    CGAffineTransform translate = CGAffineTransformMakeTranslation(-50,0);
    // Apply them to a view
    self.view.transform = CGAffineTransformConcat(translate, rotate);
    

提交回复
热议问题