Why does CGPDFPageGetDrawingTransform() crash with SIGABRT when specifying a rotation?

When I call CGPDFPageGetDrawingTransform() with a rotation argument, the application crashes. If I specify no rotation, there is no crash.

Here is my 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);
}

In the long run, I would like to rotate the pdf dynamically to follow a users heading. Maybe I am going at this all wrong...

Thank you for your time.

Answers


From the documentation for CGPDFPageGetDrawingTransform:

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

Parameters

rotate An integer, that must be a multiple of 90, that specifies the angle by which the specified rectangle is rotated clockwise.

58.46f is neither an integer nor a multiple of 90.


Need Your Help

LatLngBounds - how to get SW and NE points

google-maps google-maps-api-3

I'm trying to use Google Maps' autocomplete and bias results to LatLngBounds. I'd like to be able to draw a rectangle around an island (say the Hawaiian islands) and get the LatLngBounds that way. Is

How to check the radio button in a table column, using row id

javascript jquery html

I have an html table with two columns- text and pair radio button; I have set the id of the rows.I want to dynamically check a radio button using the id of the row.