I can't save a drawn image
I have a drawingView of type UIView where I can draw pictures. But this method save just I white area without my drawn picture. Why?
-(void)saveCurrentScreenToPhotoAlbum
{
UIGraphicsBeginImageContext(drawingView.bounds.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[drawingView.layer renderInContext:ctx];
UIImage *image = UIGraphicsGetImage开发者_开发技巧FromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
}
Off the top of my head, try moving
UIGraphicsEndImageContext();
to the bottom of the function, after you save the image. Aside from that it looks the same as the code I used. If that doesn't work, can you provide a few more details on how/when you're calling this method, and what you're drawing to the screen?
精彩评论