xcode: dibujar objetos en catiledlayer

I'm trying to draw my own objects to a CATiledLayer, im just not sure how i should push the objects to context that is used in drawLayer. For example i know that i can add the text i want to draw on the screen by declaring the text code inside the method drawLayer, however say that i want to draw something only when i get a user input, then i would like to create this new text object and draw it to the screen, but i'm not sure how i would do this outside the drawLayer method since i need the context.

preguntado el 03 de mayo de 12 a las 16:05

1 Respuestas

If you want the layer to redraw it's contents you send it a setNeedsDisplay message. Then you can draw your additional objects.

contestado el 03 de mayo de 12 a las 16:05

yes, but i was wondering how i could get a hold of the context that is used in the drawlayer method -(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context so i could use an outside function that would add the text to that context and then i would be able to call setNeedsDisplay, or is this even possible ? - Krewie

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.