当我在一个方向上缩放视图然后旋转该时间时图像被拉伸。 怎么预防这个? 我正在使用以下代码---
// ===按比例宽度=== //
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;