旋转CGPDFDocument / Page
我正在加载一个CGPDFDocument,将其作为子层添加到UIView(myContentView),然后将myContentView添加到UIScrollView。这很好。现在我想让用户在他们选择时旋转PDF。很容易让PDF最初显示一些旋转 - 我只是在这里做:
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
CGContextSaveGState (ctx);
CGContextSetRGBFillColor(ctx, 1.0, 1.0, 1.0, 1.0);
CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx));
CGContextTranslateCTM(ctx, 0.0, layer.bounds.size.height);
CGContextScaleCTM(ctx, 1.0, -1.0);
CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(myPageRef, kCGPDFCropBox, layer.bounds, rotation, true));
CGContextDrawPDFPage(ctx, myPageRef);
CGContextRestoreGState (ctx);
}
但是,如何在初始加载后执行此操作?
注意:我已经尝试过旋转myContentView,这看起来很有效,但是在完成之后,我再也无法缩放/取消缩放PDF ...我认为我需要的是强制使用新值再次调用drawLayer在“轮换”......我该怎么做?
谢谢,
史蒂夫
没有找到相关结果
已邀请:
2 个回复
纫合峭
或
消息。您必须在ivar / property中存储所需的旋转角度,并从
访问该值。
勘掸府迫路