IOS屏幕截图
2016-01-24 13:02
381 查看
要使用位图上下文
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData *data = UIImagePNGRepresentation(image); NSString *path = @"/Users/jacob/Desktop/capture.png"; [data writeToFile:path atomically:YES]; }
相关文章推荐
- iOS 绘图
- ios保持界面流程的技巧
- IOS 百度糯米客户端登录BUG
- IOS开发 深入坐标系frame,bounds,center,transform的作用于之间的联系
- ios中图片不显示的问题
- ios关于retainCount的一些疑问
- nagios安装配置
- 欢迎使用CSDN-markdown编辑器
- 超全!整理常用的iOS第三方资源
- iOS开发中用到的一些第三方库
- ios开源库
- iOS GCD使用_理解
- iOS核心动画高级技巧
- [iOS]利用系统NSRegularExpression使用正则表达式
- 百度糯米iOS客户端登录BUG
- iOS 一键加入QQ群(项目常用)
- IOS博客项目搭建-04-对文件按照功能模块结构、MVC进行分层
- iOS开发-NSURLSession详解
- iOS 中 frame、center 和bounds 的深入了解
- iOS 组透明