MapBox turn by turn navigation Custom Marker Issue

旧时模样 提交于 2019-12-13 04:07:56

问题


I am using navigation view for my application, I wan to load n number markers on navigation view with different marker images. When I tried to do this with navigation annotation view only destination image is changed others shown as 1,2,3 etc. I tried to load image using this function

func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
let reuseIdentifier = "\(annotation.coordinate)"
let annotationView1 = MGLAnnotationView(reuseIdentifier: reuseIdentifier)
if let castAnnotation = annotation as? CustomPointAnnotation {
    annotationView1.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
    let  imageV = UIImageView(frame: (annotationView1.frame))
        imageV.contentMode = .center
    imageV.image = UIImage(named: castAnnotation.image!)
    annotationView1.addSubview(imageV)
}
return annotationView1

}

来源:https://stackoverflow.com/questions/49107558/mapbox-turn-by-turn-navigation-custom-marker-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!