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