开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜