首页 > 其他 > 详细

UIImageWriteToSavedPhotosAlbum将应用中的图片保存到用户iPhone或者iTouch的相册中

时间:2016-08-09 15:01:01      阅读:539      评论:0      收藏:0      [点我收藏+]

- (void)savePicToPhotoes

{

    UIGraphicsBeginImageContext(self.view.bounds.size);

    CGContextRef ref = UIGraphicsGetCurrentContext();

    [_board.layer renderInContext:ref];

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

}

#pragma mark 显示提示框

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{

    //创建alert

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"图片已保存到相册" message:nil preferredStyle:UIAlertControllerStyleAlert];

    //创建action

    UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];

    [alert addAction:action];

    [self presentViewController:alert animated:YES completion:nil];

}

 

UIImageWriteToSavedPhotosAlbum将应用中的图片保存到用户iPhone或者iTouch的相册中

原文:http://www.cnblogs.com/ITliufei/p/5753128.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!