IOS开发之—程序截图
2014-02-14 14:55
134 查看
//获得屏幕图像
- (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];
}
- (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];
}
相关文章推荐
- IOS开发之—程序截图
- iOS 开发使用程序截图分享
- IOS开发之—程序截图
- IOS开发之—程序截图
- IOS开发之—程序截图
- IOS开发 APP提交程序上传流程
- IOS 开发 有关iPhone程序的安装目录-UUID 唯一标识
- 输出无名称的空值数组---精通android、IOS App应用服务程序开发
- iOS开发UI篇—以微博界面为例使用纯代码自定义cell程序编码全过程(一)
- iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
- IOS开发--第三阶段--微博(8)(程序5)
- IOS开发——在程序中获取Info.plist中的字段
- 在开发iOS程序时对日期处理的总结
- IOS开发学习二十二 网络程序开发时数据监控
- ios 程序内截图
- [IOS]从零开始搭建基于Xcode7的IOS开发环境和免开发者帐号真机调试运行第一个IOS程序HelloWorld
- iOS开发何如在调试的时候轻松找到程序在哪里崩溃
- iOS程序开发引用的第三方库之间出现duplicate symbol时的处理方法
- 2.iOS开发UI篇—程序启动原理和UIApplication
- iOS从入门到精通---1.iOS开发App程序启动原理