Results 1 to 3 of 3

Thread: Gestures in SKAnnotationView - iOS

  1. #1
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36

    Gestures in SKAnnotationView - iOS

    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:
    Code:
    mapview.bringSubviewToFront(annotationView)
    I have also tried bringing my annotation to the front
    Code:
    mapview.brintToFrontAnnotation(annotation)
    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).

    Thanks!

    iOS 9, Xcode 7
    Last edited by jimt2000; 23.01.2016 at 19:22.

  2. #2
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36
    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.

  3. #3
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    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
    Last edited by Adela_Silvia; 29.02.2016 at 17:07.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •