Drawing using the graphics core in CALayer

I am trying to deal with Core Graphics and Core Animation. I understand the following:

  • Using UIView, I can draw using Core Graphics, overriding drawRect.
  • I can create several CALayerand set their properties and add them

My questions: - If I create CALayerfrom scratch (without using something like CALayer *myLayer = myUIView.layer), what is the approach to drawing in this CALayer? What is the CALayer equivalent drawRectfor UIView?

I hope this makes sense.

+3
source share
1 answer

To make your own drawing, you have two options:

  1. Subclass CALayerand implement-drawInContext:
  2. , Quartz. -drawLayer:inContext:

UIView. CALayer CALayer .

+7

All Articles