I have the following code
- (void)ComputeRotationWithRadians:(CGFloat)rad {
CGFloat width = exportImage.size.width;
CGFloat height = exportImage.size.height;
UIGraphicsBeginImageContext(CGSizeMake(width, height));
CGContextRef ctxt = UIGraphicsGetCurrentContext();
CGContextScaleCTM(ctxt, 1.0, -1.0);
CGContextTranslateCTM(ctxt, 0.0, -exportImage.size.height);
CGContextRotateCTM(ctxt, rad);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), exportImage.CGImage);
exportImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[imageView setImage:exportImage];
}
The issue is that the rotation happens around the bottom left corner, when it has been calculated around the center. Is there anyway to change this?