How I would go about capturing touch events on a CATiledLayer?
I have the following situation where if I change the view layer to a CATiledLayer the view stops capturing TouchesXXX events. Why does this happens and how should I address this issue.
public partial class DocumentView : UIView
{
public DocumentView ()
{
//if the following lines are removed touch events are captured
//otherwise they are not
var tiledLayer = Layer as CATiledLayer;
tiledLayer.Delegate = new TiledLayerDelegate (this);
}
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
//does not get called if we hook TiledLayerDelegate up there in the construct
base.TouchesBegan (touches, evt);
}
}
public class TiledLayerDelegate : CALayerDelegate
{
public DocumentView DocumentView;
public TiledLayerDelegate (DocumentView documentView)
{
DocumentView = documentView;
}
public override void DrawLayer (CALayer layer, CGContext context)
{
//draw happens here
}
}