How do I keep a CALayer, sublayer of a CATiledLayer, from changing it's scale after a zoom ?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-06-06T20:18:51Z Indexed on 2010/06/12 3:32 UTC
Read the original article Hit count: 551

Filed under:
|
|
|

I have a CATiledLayer that is used to display a PDF page (this CATiledLayer is the layer type of my UIView which is a subview of a UIScrollView). I want to add overlay markers on this page. So I add a sublayer to my CATiledLayer. This sublayer again hosts the different marker's layers and acts as a grouping layer.

So graphically, I have: (keep in mind that I have multiple markers which are CALayers also, this is ascii art after all)

pdf page (CATiledLayer)
----------------------
|  CALayer           |
|  +---------+       |
|  |  +----+ |       |
|  |  |mker| |       |
|  |  +----+ |       |
|  +---------+       |
|                    |
----------------------

I have set up the canonical drawLayer:inContext: in my view for drawing the pdf.

When I zoom to have more detail, the pdf gets rendered correctly, but the markers get scaled. No matter what I do to the bounds of the CALayer, my markers always become bigger and appear jagged.

I would like to have the markers always the same size, as when they were initialized and first shown when the view was drawn. Is this possible ? or am I using a wrong approach ? Should I do special drawing for my contained CALayer in the drawLAyer:inContext: message ?

As you see, there are things that I am missing to resolve my problem. Thank you for any help you provide.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiscrollview