5

How can i change the direction (Heading) of the custom marker on Mapbox map on Swift. Here is my code

func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? {
    var annotationImage = mapView.dequeueReusableAnnotationImage(withIdentifier: "annotation")

    if annotationImage == nil {

        var image = UIImage(named: "mapdirection")!
        image = image.withAlignmentRectInsets(UIEdgeInsets(top: 0, left: 0, bottom: image.size.height/2, right: 0))

        annotationImage = MGLAnnotationImage(image: image, reuseIdentifier: "annotation")
    }
    return annotationImage
}
Daniel
  • 521
  • 1
  • 7
  • 16
Kuldeep Mishra
  • 3,846
  • 1
  • 21
  • 26

0 Answers0