1
 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. enter image description here I have no idea why the black edge appears. Why does this appear and how to avoid this?

zedzhao
  • 517
  • 1
  • 3
  • 17

0 Answers0