[摘抄]iphone开发秘籍里面的捕捉屏幕截图代码

来源:互联网 发布:网络剧排行榜前十名 编辑:程序博客网 时间:2024/05/18 04:01

+ (UIImage *) imageFromView: (UIView *) theView

{

//Draw a view`s contents into an image context

UIGraphicsBeginImageContext(theView.frame.size);

CGContextRef context = UIGraphicsGetCurrentContext();

[theView.layer renderInContext:context];

UIGraphicsEndImageContext();

return theImage;

}

--此函数要用到QuartzCore.framework框架

原创粉丝点击