CGContextDrawPDFPage taking up large amounts of memory

后端 未结 2 723
Happy的楠姐
Happy的楠姐 2020-12-01 08:52

I have a PDF file that I want to draw in outline form. I want to draw the first several pages on the document each in their own UIImage to use on a button so that when clic

2条回答
  •  时光说笑
    2020-12-01 09:10

    Try to add :

    CGContextSetInterpolationQuality(g, kCGInterpolationHigh);
    CGContextSetRenderingIntent(g, kCGRenderingIntentDefault); 
    

    before :

    CGContextDrawPDFPage(g, m_page);
    

    I had a similar issue and adding the 2 function call above resulted in the rendering using 5x less memory. Might be a bug in the CGContextXXX drawing functions

提交回复
热议问题