I rotate my image with:
UIImage *image = [UIImage imageNamed:@"doneBtn.png"];
CGImageRef imgRef = image.CGImage;
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGAffineTransform transform = CGAffineTransformIdentity;
CGRect bounds = CGRectMake(0, 0, width, height);
transform = CGAffineTransformRotate(transform, degreesToRadians(10));
UIGraphicsBeginImageContext(bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, transform);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0,0,width,height), imgRef);
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
img.image=imageCopy;
When I display the image, I see it under my 10 degree but the image is cut off on the edges.
Does somebody know how to fix this? Here’s an image for clarification.
alt text http://img197.imageshack.us/img197/7077/problemkfr.png
I have been trying all day yesterday, but can’t figure it out.
Another example image:
alt text http://img25.imageshack.us/img25/3370/afbeelding6b.png
I solved it now, i have to change the width/height value of bounds and
the x/y in CGContextDrawImage