如何在 Swift 上更改 Mapbox 地图上自定义标记的方向(标题)。这是我的代码
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
}