Reputation: 9400
I am trying to draw an image with a 2px transparent border:
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 0.0);
CGContextAddRect(context, CGRectMake(0.0, 0.0, outputImageSize.width, outputImageSize.height));
CGContextDrawPath(context, kCGPathFill);
[image drawInRect:CGRectMake(2.0,
((outputImageSize.height - userPhotoImageSize.height) / 2.0) +2.0,
userPhotoImageSize.width -4.0,
userPhotoImageSize.height -4.0)];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
It keeps getting black border (background)... =( Any ideas?
Solved, the uiimageview in which I set the image was simply black background =( The above code works!
Upvotes: 3
Views: 2057
Reputation: 9400
Solved, the uiimageview in which I set the image was simply black background =( The above code works!
Upvotes: 1