iOS捕捉屏幕截图
- 作者: 星期曰我没空
- 来源: 51数据库
- 2022-08-17
+ (UIImage *) imageFromView: (UIView *) theView
{
// Draw a view’s contents into an image context
UIGraphicsBeginImageContext(theView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[theView.layer renderInContext:context];
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
推荐阅读
