如何旋转Mapbox地图视图的自定义标记标题(方向)

时间:2017-12-14 04:52:52

标签: ios swift mapbox-gl mglmapview

如何更改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
}

0 个答案:

没有答案