DEPRECATED-mapbox-ios-sdk
DEPRECATED-mapbox-ios-sdk copied to clipboard
Handle taps on sublayers of RMMapLayer
I'll describe by example:
o I want an RMMapLayer which contains a rotated CGImage o Since mapbox modifies layer.transform manually (because of screen rotation), I put my CGImage in a sublayer (CALayer) and leave the RMMapLayer.contents empty o Now, when a tap is detected on my sublayer, mapbox doesn't see this.
The code handling this is in RMMapView.handleSingleTap:
To detect a tap on an annotation, the actual sublayer needs to be an RMapLayer, and be associated directly with an annotation. I guess I can hack this to work, but would it be possible to e.g. search all sublayers up to _overlayView, and return a tap on the first one found which is an RMMapLayer?
I assume the actual issue is slightly more general than my specific use-case. Any information/ideas would be helpful :)
It sounds like this could also clear up some of the code around detecting marker label taps as well, since those work up the hierarchy to find the parent RMMapLayer. Could just be an iteration that keeps looking at superlayer until it succeeds or hits _overlayView, as you say.
I would hack this in yourself for now, as I'm nearing a release and don't want to change this at present. But I agree it's a good way to go.
Thanks for the quick response. I'll work around it for now.
Is this still open?
Yes, haven't focused on this as it's somewhat of an edge case.