我是新来迅速4.2,我想知道我可以编辑在迅速4.例如字形像图钉图标,而不是红色标记与针会不会是一个红色标记与快餐图标?谢谢您的帮助。
这里是我的代码:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let identifier = "marker"
var view: MKMarkerAnnotationView
if let dequeuedView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)
as? MKMarkerAnnotationView {
dequeuedView.annotation = annotation
view = dequeuedView
} else {
view = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: identifier)
view.canShowCallout = true
view.calloutOffset = CGPoint(x: -5, y: 5)
view.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
}
return view
}
你不能编辑它,但你肯定可以取代它。只需设置MKMarkerAnnotationView的glyphImage
。