CALayer flickers when drawing a path

Posted by Alexey on Stack Overflow See other posts from Stack Overflow or by Alexey
Published on 2009-02-04T22:42:45Z Indexed on 2010/04/04 13:03 UTC
Read the original article Hit count: 520

I am using a CALayer to display a path via drawLayer:inContext delegate method, which resides in the view controller of the view that the layer belongs to. Each time the user moves their finger on the screen the path is updated and the layer is redrawn. However, the drawing doesn't keep up with the touches: there is always a slight lag in displaying the last two points of the path. It also flickers, but only while displaying the last two-three points again. If I just do the drawing in the view's drawRect, it works fine and the drawing is definitely fast enough.

Does anyone know why it behaves like this? I suspect it is something to do with the layer buffering, but I couldn't find any documentation about it.

© Stack Overflow or respective owner

Related posts about core-animation

Related posts about calayer