I'm trying to extend C4 a bit, and am trying to figure out how gestures and animations work on C4Shape objects. I've looked through the source, and it looks like they are all based on CAShapeLayers, to which gesture recognizers cannot be directly attached. Could someone explain how this works in C4?
Right, all visible objects in C4 are based on a subclass CALayer. For instance, C4Shapes subclass C4ShapeLayers, whereas C4Movies subclass C4PlayerLayer (a subclass of AVPlayerLayer which is already a subclass of CALayer), and images are drawn as the content of a basic CALayer.
However, each one of these layers is contained within a subclass of UIControl (UIView) so that they can all individually register touches and to which they can all have gesture recognizers attached.
As an example, the hierarchy for a C4Shape is:
For a movie:
etc.
So, all visible objects have the following:
... with custom layers for the C4Control object.