带旋转的drawAtPoint
我无法使用 drawAtPoint
将 imageView.image 绘制在正确的位置。在应用程序中,我使用 CGAffineTransformMakeRotation
来旋转图像视图,但是当我想使用 UIGraphicsGetImageFromCurrentImageContext
将 imageView 保存为与其他视图合并的一部分时,我不知道如何操作告诉它旋转..我所做的就是旋转 180 度。这是我用来将其与另一个图像合并的代码。
UIGraphicsBeginImageContext(imageView.bounds.size);
[imageView.image drawAtPoint:CGPointMake(-40,0)];
[topView.image drawAtPoint:CGPointMake(0,160)];
UIImage *mergedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
所以我的问题是:如何以 180 度或 3.14159265 弧度旋转 drawAtPoint
?
提前致谢。
I am having trouble drawing my imageView.image in the correct position using drawAtPoint
. In the app I have used CGAffineTransformMakeRotation
to rotate the image view, but when I want to save the imageView as part of a merge with others using UIGraphicsGetImageFromCurrentImageContext
I don't know how to tell it to rotate.. all I am doing is rotating 180 degrees. here is the code I am using to merge it with another image.
UIGraphicsBeginImageContext(imageView.bounds.size);
[imageView.image drawAtPoint:CGPointMake(-40,0)];
[topView.image drawAtPoint:CGPointMake(0,160)];
UIImage *mergedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
So my question is: How do I drawAtPoint
with rotation of 180 degrees or 3.14159265 radians?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以对图像内容应用变换,因此所有后续绘画操作都将使用该变换进行绘制,例如(未经测试)
You can apply a transform to the image content, so all subsequent painting operation will be drawn with that transform, e.g. (untested)