Reputation: 367
I'm using rather straightforward code to display a zoomable PDF in a scrollview, and it has been working beautifully on the iPad 2 and the original iPad. But it's staggeringly slow on the iPad 3. I know I'm pushing more pixels, but the rendering performance is simply unacceptable.
In iOS 5.0 and later, the tileSize property is arbitrarily clamped at 1024, which means tiles appear half that size on the retina display. Has anyone found a way to overcome this limitation?
Otherwise, has anyone found a way to improve the speed of the CATiledLayer
on the iPad 3?
Upvotes: 27
Views: 2445
Reputation: 7656
Did you run a time profiler on these draws and did you rule out the possibility of redundant draws?
I've had some weird double drawing, which was easily found using:
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context
{
NSLog(@"draw %@", NSStringFromCGRect(CGContextGetClipBoundingBox(context)));
// draw pdf
}
There's also a variety of settings to play with:
tiledLayer.levelsOfDetail = 2
tiledLayer.levelsOfDetailBias = 4
tiledLayer.tileSize = self.bounds.size
CGContextSetInterpolationQuality(context, kCGInterpolationLow)
CGContextSetRenderingIntent(context, kCGRenderingIntentDefault)
self.contentScaleFactor = 1.0
Upvotes: 0