- Мне нужно установить custom annotation, в зависимости от зума на карте, они будут расставлены по всему треку на карте. (Стрелки показывающие направление).
- нужно поворачивать custom annotation в зависимости от ang(направления)
мой код
class CustomPin: NSObject, MKAnnotation {
var coordinate: CLLocationCoordinate2D
var title: String?
var subtitle: String?
init(pinTitle:String, pinSubTitle:String, location:CLLocationCoordinate2D) {
self.title = pinTitle
self.subtitle = pinSubTitle
self.coordinate = location
}
}
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "customannotation")
annotationView.image = UIImage(named:"mov_on_2")
annotationView.canShowCallout = true
return annotationView
}