简体   繁体   中英

How can I avoid using CATiledLayer when rendering a PDF?

I have been trying to render PDF documents into a CATiledLayer, but this appears to be slowing down the rendering process on the iPad.

I've also tried using a normal layer, but I've not seen an improvement.

Is there any alternative to using a CATiledLayer for rendering a PDF?

CATiledLayer is necessary either by itself or as a backing layer for a UIView when you are attempting to display a view or layer that exceeds the maximum texture size supported by the GPU. Apple lists this as 1024x1024 for the iPhone, but in my experience I've been able to go up to 2048x2048 on even the first-generation iPhone.

If you are able to render to a view or layer that is smaller in both width and height than those dimensions, you don't need to use a CATiledLayer and can get away with a standard layer. The tiling process does slow rendering a bit as it brings in the appropriate tiles, so you could gain some performance that way.

For a discussion on general PDF rendering performance, I direct you to this question:

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM