ios开发中常用的截取指定区域的视图转换成图片
来源:互联网 发布:2016淘宝客服工资高吗 编辑:程序博客网 时间:2024/05/12 16:52
-(void)fullScreenshots{UIWindow *screenWindow = [[UIApplication sharedApplication] keyWindow]; UIGraphicsBeginImageContext(screenWindow.frame.size);//全屏截图,包括window [screenWindow.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);}objective c 截屏代码-(void)save{UIGraphicsBeginImageContext(mybackgroundview.bounds.size); //currentView 当前的view[mybackgroundview.layer renderInContext:UIGraphicsGetCurrentContext()];UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); //保存到相册中}截取 您想要的一层UIGraphicsBeginImageContext(CGSizeMake(320, 300)); //currentView 当前的view[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); //保存到相册中截取自定义的大小iPhone开发应用中抓图程序案例实现是本文要介绍的内容,主要是通过代码来实现抓图程序,具体实现过程,一起来看详细代码。 //获得屏幕图像 - (UIImage *)imageFromView: (UIView *) theView { UIGraphicsBeginImageContext(theView.frame.size); CGContextRef context = UIGraphicsGetCurrentContext(); [theView.layer renderInContext:context]; UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return theImage; } //获得某个范围内的屏幕图像 - (UIImage *)imageFromView: (UIView *) theView atFrame:(CGRect)r { UIGraphicsBeginImageContext(theView.frame.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); UIRectClip(r); [theView.layer renderInContext:context]; UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return theImage;//[self getImageAreaFromImage:theImage atFrame:r]; }
0 0
- ios开发中常用的截取指定区域的视图转换成图片
- 截取指定区域的并保存图片
- IOS 截取指定区域的图像
- iOS 如何截取超出屏幕区域的图片
- JavaScript截取字符串指定区域的内容
- PhotoShop8-截取图片中固定像素的区域
- 截取图片中间矩形区域的图片
- 拉伸图片的指定区域
- 我收集的一些资源 II: 霓虹灯效果、截取指定区域的图片、ListView分页显示
- iOS中截取屏幕的图片
- ios 图片的截取
- ios 图片的截取
- iphone中模糊图片的指定区域的实现
- iOS开发技巧之:截取字符串中两个指定字符串中间的字符串
- 屏幕区域截取图片的实现
- java中使用jcrop截取指定大小的图片
- iOS截取特定区域的图片,然后拼接起来,可在图片上定制任意控件
- iOS中在指定视图内进行代码截屏操作,并返回特定的图片
- hdu 2112 HDU Today(spfa+map+vector)
- jQuery-Ajax格式用法
- sed 替换命令
- Android开发:shape和selector和layer-list的(详细说明)
- ORA-15291 错误解决
- ios开发中常用的截取指定区域的视图转换成图片
- Libevent源码分析-----开篇
- Objective-C 和 Core Foundation 对象相互转换的内存管理总结
- Unique Binary Search Trees II
- 常用几何算法概论
- Boost 的备署和一些问题的解决
- 自己写了一个带placeHolder的textView,分享给大家
- jquery循环遍历页面上的radio,checkbox,text,textarea
- 把每句话的第一个字母换成大写字母