1

我无法使用 .将 imageView.image 绘制到正确的位置drawAtPoint。在应用程序中,我曾经CGAffineTransformMakeRotation旋转图像视图,但是当我想将 imageView 保存为与其他人合并的一部分时,UIGraphicsGetImageFromCurrentImageContext我不知道如何告诉它旋转.. 我所做的只是旋转 180 度。这是我用来将其与另一个图像合并的代码。

UIGraphicsBeginImageContext(imageView.bounds.size); 

[imageView.image drawAtPoint:CGPointMake(-40,0)];
[topView.image drawAtPoint:CGPointMake(0,160)];

UIImage *mergedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

所以我的问题是:我如何drawAtPoint旋转 180 度或 3.14159265 弧度?

提前致谢。

4

1 回答 1

4

您可以对图像内容应用变换,因此所有后续绘画操作都将使用该变换进行绘制,例如(未经测试)

UIGraphicsBeginImageContext(size);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextRotateCTM(c, M_PI/6);
[image drawAtPoint:CGPointZero];
...
于 2011-05-18T17:26:54.380 回答