截取webview的屏幕截图并将其发送至AirPrint.
// TAKE SCREENSHOT
CGRect myRect = [self.view bounds];
UIGraphicsBeginImageContext(myRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, myRect);
[self.view.layer renderInContext:ctx];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
NSData *imageData = UIImageJPEGRepresentation(viewImage, 1.0);
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1648 次 |
| 最近记录: |