Due to various reasons, I am considering the possibility of my own implementation of CATiledLayer. I did some research, but it seems like I can't figure out how CATiledLayer knows which slab to provide. For example, when you scroll through a layer, setPosition: or setBounds: is never called. It looks like the background thread just calls drawLayer: inContext: from the delegate in blue without any triggers. I found out that CATiledLayer calls setContent: with an instance of "CAImageProvider", and all drawLayer: inContext: calls come from this class. So this is probably the key to determining which plate to draw. But I can not find the documentation for this class.
So ... does anyone know how this works, and how can I redefine it?
Regarding the disadvantages of CATiledLayer:
- it always uses screen resolution (or x2, x4, etc.); you cannot set it to native resolution of source images
- you cannot specify any other scaling factor than 2
- you need to specify the levels OffDetail and levelsOfDetailBias, for which I do not see the reason for the implementation at all. If you have content that is infinitely scalable, such as fractals, then this is very limiting.
- Most importantly: if you limit it to scaling in only one direction (I do this by making the scale factor in one direction equal to 1 in setTransform :), it works all weird
source share