保存图片到本地相册
2016-03-09 17:25
302 查看
-(void)tapSaveBGView { NSLog(@"保存到本地相册"); UIImageWriteToSavedPhotosAlbum(_customQRView.qRImg.image, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil); } - (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { NSString *message = @"提示"; if (!error) { message = @"成功保存到相册"; }else { message = [error description]; } NSLog(@"message is %@",message); [self presentMessageTips:message]; }
用 UIImageWriteToSavedPhotosAlbum(imageSave, nil, nil, nil), imageSave是UIImage类型,这样就保存进去了。
而且注意图片不宜过大,以免程序崩
下面是高清版
UIGraphicsBeginImageContextWithOptions(_customQRView.bounds.size, _customQRView.opaque,0.0); [_customQRView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(img, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
相关文章推荐
- 动态规划(方案还原):SGU 104 Little shop of flowers
- 【GDOI 2016模拟3.9】暴走的图灵机
- 设置继承自UIScrollView控件的滚动速度
- 小工具-串口连接数据对比
- kakfa源码编译打包
- 宝马E91318D读写EDC17 C41与KESS V2 DDE8错误
- android添加library遇到的问题(转)
- rtc关机闹钟4 AlarmManagerService.java
- dirname(__FILE__) 的使用总结 2(转)
- ora-02064不支持分布式操作与Oracle自治事务
- Safari上 input 无法触发trigger change事件
- 百宝云开源【易语言网络验证系统】完整版,可一键安装
- GPRS-SIM900模块应用程序——发短信打电话
- socket与http的区别
- ios
- dirname(__FILE__) 的使用总结 1(转)
- Servlet单实例多线程模式
- Titanic Kaggle 竞赛系列
- JAVA利用HttpClient进行POST请求(HTTPS)
- Android开发入门应用启动常见关于Splash的优缺点