1
我有一個2835像素的PDF文件內2835像素的UIScrollView。 要顯示PDF,我使用CATiledLayer。PDF放大UIScrollView內
我的問題是,當我縮小scrollView(小於1的比例)PDF質量變得非常糟糕。奇怪的是,當我放大scrollView(大於1的比例)時,PDF看起來很棒。 放大得越多(比例* 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);
}