Когда я вызываю CGPDFPageGetDrawingTransform () с аргументом поворота, приложение вылетает. Если я укажу без вращения, не будет сбоев.
Вот мой drawLayer: inContext: method:
- (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-файл, следуя указаниям пользователей. Может быть, я все это неправильно ...
Спасибо за ваше время.