hi all i rotate my UIImage for crop. when i am rotate my image it just cuts from corners here my code.
-(UIImage*)imageLeftRotation:(UIImage*) newImage size:(CGSize) imgSize angle:(int) rotateAngle{
UIImage *image = newImage;
CGImageRef imgRef = image.CGImage;
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGAffineTransform transform = CGAffineTransformIdentity;
CGRect bounds = CGRectMake(0, 0, width+angle, height+angle);
transform = CGAffineTransformRotate(transform, degreesToRadians(angle));
UIGraphicsBeginImageContext(bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, transform);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(angle,0,width,height), imgRef);
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
mainImages =[imageCopy retain];
}
how does i can resolve this and where i am wrong.
Deepika