I'm developing some kind of card game in which my view objects (cards, etc) are all CALayers. These objects are added as sublayers of a mainBoard
(a CALayer), which, in turn, is a sublayer of the [UIView layer]
property of my mainView
. Everything is Ok, I can do hit testing to verify which layer is being touched through the touchesBegan:withEvent:
callback of the mainView
class normally, and so on.
However, I need to have a scroll inside my mainBoard
to show "bigger" CALayers, so I tried first adding the "bigger" CALayer inside a CAScrollLayer
, but I noticed that the CAScrollLayer
doesn't really scroll (doesn't handle user input, neither draws scrollbars). So, the workaround would be to add an UIScrollView directly to the mainView
UIView. The UIScrollView
scrolls perfectly, until I try to add the "bigger" layer to it, by using [scrollView.layer addSublayer:<bigger layer>]
.
Does anyone has any idea of how I can have "scrollable" objects inside a CALayer?
Thanks!