2011-03-10 63 views
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); 

} 

回答

0

我將levelOfDetail和levelsOfDetailBias都設置爲10.這將所有的縮放都轉移到了更高的範圍。現在我將levelsOfDetail更改爲10,並將levelsOfDetailBias更改爲7,並且一切正常。