View Full Version : Gestures in SKAnnotationView - iOS

22.01.2016, 01:10
I have a custom annotation view setup for an annotation. I cannot interact with the view I have setup as the annotation view. Any gestures I use on my custom annotation view get no response. The map responds to gestures as if the annotation view were not there. For example, if I double tap the view, the map zooms in.

I have to be able to respond to gestures. My view has subviews that need to respond to gestures. For example, I have a scroll view that must scroll. Attempting to scroll the view pans the map as if the annotationView and its scroll view were not there.

I have tried bringing my view to front:


I have also tried bringing my annotation to the front


This is an important feature we need to support. Any idea on how we can do this?

Upon further inspection, I find that the view is never used as a view. I can see it never has a superview so it never gets added as a subview to any other view. I suspect it is added as an image in a layer on the map so the user cannot interact with it.

I still need a way to do this (add a view that I can interact with, and have that view anchored to a location on the map).


iOS 9, Xcode 7

26.01.2016, 17:14
I presume this cannot be done with SKAnnotationView

Instead, I ended up adding my UIView as a subview of the map view. (Actually, in my case, I add it as a subview to a view whose bounds are filled by the actual SKMapView.) Then I position it using pointForCoordinate to translate between the map view and screen coordinate (which i then translate to a view coordinate). I also have to catch mapView:didChangeToRegion to update the position of my view as the map pans/zooms.

05.02.2016, 13:51
We'll need to ask the support of our developers

[Update: 29-02-2016]: We got the feedback from our developers and it seems that interacting with annotation views is not possible.
You could receive a callback if the annotation was tapped, but you won't have full control over the interaction with it.
A workaround would be to use the pointForCoordinate and coordinateForPoint methods in order to manually place the view at the desired location on screen, though it might not be great in terms of performance, especially if you're using lots of annotations