Search code examples
iosswiftmapboxmapbox-ios

Function for when map is interacted with


I was wondering if there is an inbuilt function that is called whenever a map box map is interacted with?

I’m wondering this because I want to have an image appear whenever the map is moved.

Thanks


Solution

  • Yes, you should use one of the MGLMapViewDelegate methods depending on your requirements:

    -mapView:regionWillChangeAnimated: -mapViewRegionIsChanging: -mapView:regionDidChangeAnimated:

    You can read about their implementation in the MapBox api reference here: Mapbox api