开发者

How to take graphics drawn in the UIView and save as a jpg or something else on the iPhone to pull up in the "Photos"?

开发者 https://www.devze.com 2023-03-24 22:14 出处:网络
How to take graphics drawn in the UIView and save as a jpg or something o开发者_开发技巧n the iPhone to pull up in the \"Photos\" and or attach to an email?

How to take graphics drawn in the UIView and save as a jpg or something o开发者_开发技巧n the iPhone to pull up in the "Photos" and or attach to an email?

thanks


It's fairly straightforward to get a UIImage:

UIImage* image = nil;

UIGraphicsBeginImageContext(_myView.frame.size);
{
    [_myView.layer renderInContext: UIGraphicsGetCurrentContext()];
    image = UIGraphicsGetImageFromCurrentImageContext();
}
UIGraphicsEndImageContext(); 

Then save to the photos library with this:

UIImageWriteToSavedPhotosAlbum(_myView, ,

0

精彩评论

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