Re: Simulating sublayers in CATiledLayer
Re: Simulating sublayers in CATiledLayer
- Subject: Re: Simulating sublayers in CATiledLayer
- From: Remco Poelstra <email@hidden>
- Date: Tue, 25 Mar 2014 17:50:25 +0100
> Op 25 mrt. 2014 om 17:25 heeft David Duncan <email@hidden> het volgende geschreven:
>
>> On Mar 25, 2014, at 1:56 AM, Remco Poelstra <email@hidden> wrote:
>>
>> David Duncan schreef op 24-3-2014 20:41:
>>> On Mar 22, 2014, at 2:18 AM, Remco Poelstra <email@hidden> wrote:
>>>
>>>> How can I make sure that some custom drawing method get's called?
>>>
>>>
>>> Call -setNeedsDisplay on the layer (layers are valid by default)
>>
>> Hi,
>>
>> I tried that, but it only draws the layer once. When I zoom in, the content becomes pixelated. I tried to subclass CATiledLayer and override -setAffineTransform to set the contentsScale of all sub layers depending on the current transform, but that gives all sorts of drawing errors.
>> Is there a way to keep the custom drawn content sharp? Like with CAShapeLayers?
>
> Is this a CATiledLayer or a CALayer? CALayers don’t redraw like this when you zoom, and while there are a few techniques for doing this yourself, you have to be fairly careful to avoid huge memory spikes.
>
> For CATiledLayer you need to ensure the levelOfDetail and levelOfDetailBias is set correctly, but that should be about it.
>
> CAShapeLayers redraw automatically because they are vector content and as such can be resized. CALayers and CATiledLayers display bitmap content – tiled layers only get shaper because they are designed to maintain multiple levels of detail.
I've tried with both CALayer and CATiledLayer sublayers, but the CATiledLayer also did not redraw (at higher resolution) when its parent layer has a transform. I think because the sublayer knows nothing about the transform of the parent layer.
I'm also uncertain about the best moment to call setneedsdisplay on the sublayers when zooming and panning.
Remco
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden