gpt4 book ai didi

ios - PDF 在 UIScrollView 中缩放

转载 作者:行者123 更新时间:2023-11-28 17:46:55 27 4
gpt4 key购买 nike

我在 2835 像素的 UIScrollView 中有一个 2835 像素的 PDF 文件。为了显示 PDF,我使用 CATiledLayer。

我的问题是,当我缩小 scrollView(比例小于 1)时,PDF 质量变得很差。奇怪的是,当我放大 scrollView(比例超过 1)时,PDF 看起来很棒。 我放大的越多 (scale*10) 质量越好。

如何更改代码,使低频和高频质量都很好?

// Draw the CGPDFPageRef into the layer at the correct scale.
-(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
{
// First fill the background with white.
//CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
CGContextFillRect(context,CGRectMake(0, 0, 2835,1417));

CGContextSetInterpolationQuality(context, kCGInterpolationHigh);

CGContextSaveGState(context);
// Flip the context so that the PDF page is rendered
// right side up.
CGContextTranslateCTM(context, 0.0, 1417);
CGContextScaleCTM(context, 1.0, -1.0);

// Scale the context so that the PDF page is rendered
// at the correct size for the zoom level.
CGContextScaleCTM(context, myScale,myScale);
CGContextDrawPDFPage(context, pdfPage);
CGContextRestoreGState(context);

}

最佳答案

我将 levelsOfDetail 和 levelsOfDetailBias 都设置为 10。这将所有缩放转换为升级。现在我将 levelsOfDetail 更改为 10,将 levelsOfDetailBias 更改为 7,一切正常。

关于ios - PDF 在 UIScrollView 中缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5266864/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com