美文网首页
iOS获取屏幕图像

iOS获取屏幕图像

作者: Leeson1989 | 来源:发表于2017-07-20 18:24 被阅读26次

//获得屏幕图像

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

{

UIGraphicsBeginImageContext(theView.frame.size);

CGContextRef context = UIGraphicsGetCurrentContext();

[theView.layer renderInContext:context];

UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return theImage;

}

相关文章

网友评论

      本文标题:iOS获取屏幕图像

      本文链接:https://www.haomeiwen.com/subject/prejkxtx.html