I'm trying to draw image using UIImage
's drawInRect:
method. Here is the code:
UIImage *image = [UIImage imageNamed:@"OrangeBadge.png"];
UIGraphicsBeginImageContext(image.size);
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
The problem is that the resulting image is blurry. Here is the resulting image (on the right side) compared to the source image (on the left side):
I've tried both CGContextSetAllowsAntialiasing(UIGraphicsGetCurrentContext(), NO)
CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), NO)
but this did not solve the problem.
Any ideas?
Thanks in advance.