func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? {
let annotation = annotation as! CustomMapAnnotation
var annotationImage = mapView.dequeueReusableAnnotationImage(withIdentifier: annotation.id)
if annotationImage == nil {
var image = UIImage(named: "taxi")!
if let heading = annotation.heading {
image = image.imageRotatedByDegrees(degrees: heading)
}
image = image.withAlignmentRectInsets(UIEdgeInsets(top: 0, left: 0, bottom: image.size.height/2, right: 0))
annotationImage = MGLAnnotationImage(image: image, reuseIdentifier: annotation.id)
}
return annotationImage
}
我已经在出租车预订应用程序中添加了MAPBOX,同时在汽车注释中添加了标题,以便根据道路方向旋转图片,但是其中显示了一些错误,请帮我解决。