Quartz2D截屏
截屏
2023-09-14 08:57:59 时间
self.view.backgroundColor=[UIColor yellowColor];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:@"按钮" forState:UIControlStateNormal];
btn.frame=CGRectMake(30, 100, 40, 20);
[btn setTintColor:[UIColor blackColor]];
[btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
-(void)btnclick:(id)sender
//延迟2秒执行
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int16_t)2*NSEC_PER_SEC), dispatch_get_main_queue(), ^{
//UIGraphicsBeginImageContext参考 http://blog.sina.com.cn/s/blog_5fb39f9101017n1v.html
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//保存到相册
UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
//保存到指定路径中
// NSString *path = [[NSHomeDirectory()stringByAppendingPathComponent:@"Documents"]stringByAppendingPathComponent:@"image.png"];
// NSLog(@"%@",path);
// NSData *data=UIImagePNGRepresentation(img);
// [data writeToFile:path atomically:YES];
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
if (error==nil) {
NSLog(@"ok");
else
NSLog(@"error");
NSLog(@"%@",error);
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@end
Android项目实战(四十四):Zxing二维码切换横屏扫描 原文:Android项目实战(四十四):Zxing二维码切换横屏扫描 Demo链接 默认是竖屏扫描,但是当我们在清单文件中配置横屏显示的时候:
iOS - Quartz 2D 下载进度按钮绘制 1、绘制下载进度按钮 具体实现代码见 GitHub 源码 QExtension QProgressButton.h @interface QProgressButton : UIButton /// 进度值,范围 0 ~ 1 @property (nonatomic, ...
iOS - Quartz 2D 手势截屏绘制 1、绘制手势截屏 具体实现代码见 GitHub 源码 QExtension QTouchClipView.h @interface QTouchClipView : UIView * 创建手势截屏视图控件,获取截屏结果 * @par...
iOS - Quartz 2D 第三方框架 Charts 绘制图表 1、Charts 简介 使用第三方框架 Charts 绘制 iOS 图表。GitHub 源码 Charts Charts 是一款用于绘制图表的框架,可以绘制柱状图、折线图、K线图、饼状图等。Charts 只有 Swift 版本。
社会主义 从.Net到iOS,在撸的道路上越走越远,工作之余经营着博客园http://www.cnblogs.com/5ishare,欢迎小伙伴(妹子更好)一起交流,谈谈人生理想。作为经常从网上索取免费资料的一员,要有回报回报的思想,也让更多的人少走弯路.
Android项目实战(四十四):Zxing二维码切换横屏扫描 原文:Android项目实战(四十四):Zxing二维码切换横屏扫描 Demo链接 默认是竖屏扫描,但是当我们在清单文件中配置横屏显示的时候:
iOS - Quartz 2D 下载进度按钮绘制 1、绘制下载进度按钮 具体实现代码见 GitHub 源码 QExtension QProgressButton.h @interface QProgressButton : UIButton /// 进度值,范围 0 ~ 1 @property (nonatomic, ...
iOS - Quartz 2D 手势截屏绘制 1、绘制手势截屏 具体实现代码见 GitHub 源码 QExtension QTouchClipView.h @interface QTouchClipView : UIView * 创建手势截屏视图控件,获取截屏结果 * @par...
iOS - Quartz 2D 第三方框架 Charts 绘制图表 1、Charts 简介 使用第三方框架 Charts 绘制 iOS 图表。GitHub 源码 Charts Charts 是一款用于绘制图表的框架,可以绘制柱状图、折线图、K线图、饼状图等。Charts 只有 Swift 版本。
社会主义 从.Net到iOS,在撸的道路上越走越远,工作之余经营着博客园http://www.cnblogs.com/5ishare,欢迎小伙伴(妹子更好)一起交流,谈谈人生理想。作为经常从网上索取免费资料的一员,要有回报回报的思想,也让更多的人少走弯路.
相关文章
- Unity图片处理类,包括压缩、截屏和滤镜
- Javascript网页截屏的方法
- Linux 下的截屏并编辑的工具介绍
- 如何用Chrome自带的截屏功能截取超过一个屏幕的网页
- Android adb截屏命令
- Qt 截屏的方法
- 【读书笔记】iOS-截屏功能的实现。
- phantomjs 长图截屏
- android截屏与截长图截屏功能的实现
- Ubuntu18.04截屏编辑工具flameshot(四十)
- Mac截屏快捷键
- Spectacle/Flameshot/X11 Xlib截屏问题现象及解决方法
- X11 Xlib截屏问题及深入分析五 —— XOpenDisplay函数源码分析(2)
- X11 Xlib截屏问题及深入分析四 —— XOpenDisplay函数源码分析(1)
- X11 Xlib截屏问题及深入分析一 —— 源码位置