I have a very, very large UIView, which uses a CATiledLayer.
I need to render a lot of small images onto it.
These small images are stored in one large image (1024x1024). They may have transparency.
At the moment, I use CGImageCreateWithImageInRect on the large image to create CGImageRefs for each small image that I need.
Later, within drawRect, I call CGContextDrawImage(context, rect, smallImage); to display each of these small images, as required.
According to Instruments' Time Profiler, however, there's a very large bottleneck at CGContextDrawImage (274ms), and I wish to reduce that as best I can (short of using OpenGL).
My question is: how? Is there an alternative to CGContextDrawImage which does not require scaling? Is using CGImageCreateWithImageInRect the right way to go about it?
[CATiledLayer class]. Thanks for the link, but I should point out that the big image is just an image map for the little images, which are distributed over the extremely large UIView and not tiled together.CGContextDrawImagehas been identified as slow by Instruments. So what's the solution? Hope that clarifies the problem.