Applying scaling and rotation on a view using CGAffineTransform

前端 未结 4 730
轮回少年
轮回少年 2021-01-11 10:45

So I need to apply some scaling and some rotation to a view (I do this using gestures), so for each gesture I update the current scalling and rotation values with something

4条回答
  •  终归单人心
    2021-01-11 11:28

    Try applying the transformations to the identity transform, e.g.

    CGAffineTransform transform = CGAffineTransformIdentity;
    transform = CGAffineTransformScale(transform, scaleWidth, scaleHeight);
    transform = CGAffineTransformRotate(transform, angle);
    viewToTransform.transform = transform;
    

提交回复
热议问题