I have a UIView subclass with custom
- (void)drawRect:(CGRect)rect
I want to draw an UIImage at position 50,50 and have it rotated by 20 degrees.
I tried the following code:
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextRotateCTM (context, degreesToRad(20));
[image drawAtPoint:CGPointMake(50, 50)];
CGContextRestoreGState(context);
It rotates the image correctly, but it is not at 50,50...
How can I rotate an UIImage while maintaining the correct coordinates?