1

我一直在尝试将某些 UIView 保存到 PDF,在某些情况下它会崩溃。请注意特定 UIView 的崩溃。在这段代码中,崩溃开始于UIGraphicsEndPDFContext我在这里做错了什么?..这使得错误在某些 UIViews 上不一致?

   NSMutableData *pdfData = [NSMutableData data];

        UIGraphicsBeginPDFContextToData(pdfData,CGRectMake(0, 0, 0,0   ), nil);
        // Points the pdf converter to the mutable data object and to the UIView to be converted


        // draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
        [contentViews enumerateKeysAndObjectsUsingBlock: // Enumerate content views
         ^(id key, id object, BOOL *stop) {

             ReaderContentView *contentView = object;

             UIGraphicsBeginPDFPage();
             CGContextRef pdfContext = UIGraphicsGetCurrentContext();

             [contentView.theContentView.layer renderInContext:pdfContext];

         }];    

        UIGraphicsEndPDFContext();

崩溃在第一行

0x33e69884:  ldr    r2, [r0], #4
0x33e69888:  beq    0x33e6989c               ; strlen + 36

多谢你们!

4

0 回答 0