Get just the scaling transformation out of CGAffineTransform

前端 未结 7 1108
北荒
北荒 2021-02-01 19:26

I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix.

Matrixes are not my strength

7条回答
  •  情深已故
    2021-02-01 19:59

    - (CGFloat)xscale {
        CGAffineTransform t = self.transform;
        return sqrt(t.a * t.a + t.c * t.c);
    }
    
    - (CGFloat)yscale {
        CGAffineTransform t = self.transform;
        return sqrt(t.b * t.b + t.d * t.d);
    }
    

提交回复
热议问题