-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Interacting with annotation points in style layer #6505
Comments
Unlike annotations, style layers don’t come with interactivity and callout views out of the box. Instead, you have to build it yourself: install your own tap gesture recognizer, call I know this sounds like a lot of work. #6181 would make annotations more like style layers, in the process adding a lot of annotation-like functionality to style layers in general. That’s quite a ways off, however. #6515 would make the gesture recognition part a little easier, and we could add an API for displaying callout views for non-annotations as part of #4392. Meanwhile, under the hood, annotations are already implemented using style layers to some extent; once #6097 lands, you’ll be able to use an annotation but otherwise treat it like part of a style layer, more or less. |
Works perfectly, thanks for your help @1ec5. Here's how I did it (for others):
|
Maybe found a bug with the solution above, see issue #6538 |
Platform: iOS 10, Swift 3
Mapbox SDK version: 3.4.0-alpha.4
First: Let me thank the Mapbox community. I'm using Mapbox since more than a week and may have seen just the tip of the iceberg, still learning a lot of things everyday, and I'm really impressed about the fast responsiveness of this community.
While I'm currently building an app for a client using the Mapbox iOS SDK, knowing that there a lot of features to come in the future (especially runtime styling), I often miss a few things that'd be great for future releases (and that's why I'm always writing down my thoughts and ideas which can help improve Mapbox for iOS. Because of the lack of documentation for the newest version of Mapbox iOS SDK, I first check in code, if there is a possible solution to my problem, if not, I check if there's a planned feature/issue written down in the repo, if not, I'm going to write an issue).
Now to my question: Is there a way to interact with annotation points in a style layer coming from a style URL? Because
public func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation)
isn't called when I touch a point in a style layer.The text was updated successfully, but these errors were encountered: