我正在加载 3 个不同的 PDF 文件并干燥以使用 drawLayer 将它们绘制到 3 个 UIviews 中。这可行,但它们都是 3 被绘制到一个 UIview 的同一层中。我需要将它们分别绘制到自己的 UIView 中,但我不知道如何将这段代码解析为三个部分。请问有什么想法吗?
// This method takes care of the cropping and adds each PDF layer to the view
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context {
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextFillRect(context, CGContextGetClipBoundingBox(context));
CGContextTranslateCTM(context, 0.0, layer.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(mappageRef, kCGPDFCropBox, layer.bounds, 0, true));
CGContextDrawPDFPage(context, mappageRef);
CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(vorpageRef, kCGPDFCropBox, layer.bounds, 0, true));
CGContextDrawPDFPage(context, vorpageRef);
CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(labelpageRef, kCGPDFCropBox, layer.bounds, 0, true));
CGContextDrawPDFPage(context, labelpageRef);
}