UIGraphicsBeginImageContextWithOptions(size, YES, [UIScreen mainScreen].scale);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
[[UIColor whiteColor] set];
CGContextFillRect(context, CGRectMake(0, 0, size.width, size.height));
CGContextRestoreGState(context);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
I am using this code above to generate a image. when I use UIGraphicsBeginImageContextWithOptions(size, ***YES***, [UIScreen mainScreen].scale)
and set the opaque property to YES. I get an image with black edge in right and bottom.
I have no idea why the black edge appears. Why does this appear and how to avoid this?