在我的应用程序中,我应用了不同类型的转换,例如向左旋转、向右旋转、垂直翻转、水平翻转到UIImageview
. 应用这些操作后,位置发生了UIImageview
变化。我希望将此更改后的图像分配给其他视图,而不是原始图像。当我分配imageview.image
给另一个视图时,它正在分配原始图像。我该如何纠正这个问题?
正如大卫所建议的那样。我正在为左旋转应用以下代码
//rotation left;
int x1=ivPhoto.frame.origin.x;
int y1=ivPhoto.frame.origin.y;
UIGraphicsBeginImageContext(ivPhoto.image.size);
CGAffineTransform transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(degrees2));
CGContextConcatCTM(UIGraphicsGetCurrentContext(), transform);
[ivPhoto.image drawInRect:CGRectMake(x1,y1,ivPhoto.frame.size.width, ivPhoto.frame.size.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
ivPhoto.image=newImage;
但我没有得到旋转的图像。图像处于原始位置