1

3 つの異なる PDF ファイルを読み込んで乾燥させ、drawLayer を使用してそれらを 3 つの UIview に描画しています。これは機能しますが、3 つすべてが 1 つの UIview の同じレイヤーに描画されます。それぞれ独自の UIView に描画する必要がありますが、このコードを 3 つの部分に解析する方法がわかりません。アイデアはありますか?

// 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);
}
4

1 に答える 1

0

CALayer は単一の UIView に属し、他のレイヤーではなく、それ自体のみを描画します。各 PDF ファイルを正しいビューに送信し、各ビューでそれを独自のレイヤーに描画させるには、コントローラーが必要です。

于 2012-02-29T17:47:16.360 に答える