截图
来源:互联网 发布:重生之网络娱乐小说 编辑:程序博客网 时间:2024/05/16 21:24
//这里返回的是一张图片 根据所给颜色返回一张此颜色的图片+ (UIImage *)convertColorToImage:(UIColor *)color { CGRect rect = CGRectMake(0, 0, 1, 1); //设置截取的大小 UIGraphicsBeginImageContext(rect.size); // CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); // UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // return theImage;}//根据图层进行截图-(UIImage *)screenShots{ //截图 //设置大小 UIGraphicsBeginImageContext(shareImageView.frame.size); //选择要截取的图层(自己想要截取的view) [shareImageView.layer renderInContext:UIGraphicsGetCurrentContext()]; //得到截取的图片 UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);(将截图保存到相册中) return viewImage;}
0 0
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- 截图
- JS对象
- SpringMVC参数传递
- 初探UiAutomator(四)
- 这酸爽!android studio 2.0的模拟器如何快速Instant Run
- 详解神秘Linux内核
- 截图
- 我的代码风格规范(动态更新)
- JavaScript学习(4.6):关系表达式
- swift开发笔记16 - 使用xib自定义一个控件(复合控件)
- map.entry简介
- redis配置文件样例(二)
- HTML5全屏背景视频jQuery插件
- Linux启动过程详解
- 如何下载谷歌地球高程并导出等高线为DXF文件