2010-06-05 52 views
0

當我用旋轉參數調用CGPDFPageGetDrawingTransform()時,應用程序崩潰。如果我指定不旋轉,則不會崩潰。爲什麼CGPDFPageGetDrawingTransform()在指定旋轉時與SIGABRT一起崩潰?

這裏是我的drawLayer:inContext的:方法:

- (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context 
{ 
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); 
    CGRect boundingBox = CGContextGetClipBoundingBox(context); 
    CGContextFillRect(context, boundingBox); 

    //convert to UIKit native coodinate system 
    CGContextTranslateCTM(context, 0.0, self.bounds.size.height); 
CGContextScaleCTM(context, 1.0, -1.0); 

    //Rotate the pdf_page 
    CGAffineTransform pfd_transform = CGPDFPageGetDrawingTransform(self.page, kCGPDFCropBox, self.frame, 58.46f, true); 

    CGContextSaveGState (context); 
    CGContextConcatCTM (context, pfd_transform); 
    CGContextClipToRect (context, self.frame); 
    CGContextDrawPDFPage (context, self.page); 
    CGContextRestoreGState (context); 
} 

從長遠來看,我想動態旋轉PDF遵循用戶的標題。也許我在這一切都是錯誤的...

謝謝你的時間。

回答

1

從文檔CGPDFPageGetDrawingTransform

CGAffineTransform CGPDFPageGetDrawingTransform (CGPDFPageRef page, CGPDFBox box, CGRect rect, int rotate, bool preserveAspectRatio);

參數

rotate的整數,必須是90的倍數,它指定在指定的矩形是角順時針旋轉。

58.46f既不是一個整數,也不是90

+0

03,我應該有更多的文字和依賴少了些什麼,我試圖做多!謝謝! – David 2010-06-06 02:26:51

相關問題