从UIView里面截图 - Obtain UIImage From UIView
来源:互联网 发布:国外网络域名 编辑:程序博客网 时间:2024/05/18 10:59
昨天回答了一个老外的问题,呵呵,用英文解释给他听,他不懂,不知道是我英文写的不好还是它不懂,自己贴下:
-only capture a screen UIView
how can i capture a scree with the use of coding..?
-here is a function "drawRect" in UIView , you can obtain the current CGcontextRef in use of "UIGraphicsGetCurrentContext()", then use "CGBitmapContextCreateImage()" function to create CGImageRef, that may be you want !
-in that i can made UIView convert into image ..?
-yes , you just convert CGImageRef to UIImage
-i dont understand you have any semple code then plz send me.....
-wait!
非得要源码,刚好自己也总结下:
/*
send [self setNeedsDisplay] to obtain UIImage
*/
- (void) drawRect:(CGRect)clip
{
// obtain the UIView context
CGContextRef context = UIGraphicsGetCurrentContext();
// create CGImageRef frome UIView context
CGImageRefimageref;
imageref = CGBitmapContextCreateImage(context);
// convert CGImageRef to UIImage;
UIImage*uiImage;
uiImage =[UIImage imageWithCGImage:imageref];
CGImageRelease(imageref);
}
- 从UIView里面截图 - Obtain UIImage From UIView
- uiview 截图
- UIView截图
- UIView转化成UIImage
- UIView 转 UIImage
- UIView 转 UIImage IOS
- UIView转UIImage
- UIView 转化成UIImage
- UIView换UIImage
- UIView截取图片UIimage
- UIView转UIImage
- UIView 转 UIImage
- UIview转换UIimage
- UIView转成UIImage
- uiview转换成uiimage
- IOS 将UIView转成UIImage
- ios UiView转换成UIImage
- iOS UIView、UIImage、NSData转换
- Asp.net中Frameset的使用小结
- 有关Eclipse 的资源
- Visual Studio 2008 每日提示(一)
- 转帖: Cookie和会话状态的工作原理及Cookie欺骗
- Head First C# 中文版 图文皆译 第三章 page88
- 从UIView里面截图 - Obtain UIImage From UIView
- 开博的首言
- php 投票模块 2
- FLEX提高篇--------AIR应用程序的托盘及托盘菜单的制作
- PowerBuilder被忽略的的技术
- Buzzword样式的右键菜单 Customized Context Menu as Buzzword
- 影响创业者行动力的五大理由
- 文件系统的制作
- ORACLE 11 linux下的安装