1

当我在一个方向上缩放视图然后旋转那个时候图像被拉伸。如何防止这种情况?我正在使用如下代码---

//===通过缩放宽度===//

    float scale = [self widthResizeDistance:origin toPoint:touchLocationpoint]; // [self widthResizeDistance:origin toPoint:PrevioustouchLocationpoint];
    CGAffineTransform newTransform2 = CGAffineTransformScale(self.transform, scale,1.0);
    self.transform = newTransform2;

//===然后通过旋转===//

    CGAffineTransform newTransform = CGAffineTransformScale(self.transform, 1, 1);
        CGFloat previousRotation = atan2(previousDifference.y, previousDifference.x);
        CGPoint currentDifference = [self vectorFromPoint:origin toPoint:touchLocationpoint];
        CGFloat currentRotation = atan2(currentDifference.y, currentDifference.x);
        CGFloat newAngle = currentRotation- previousRotation;

        newTransform = CGAffineTransformRotate(newTransform, newAngle);
        self.transform = newTransform;
4

0 回答 0