小编Jam*_*Voo的帖子

如何在不更改 Swift 中默认位置引脚的情况下更改 MapKit 中的markerTintColor?

我有 MKMarkerAnnotationView 来更改地图上图钉的颜色。

func mapView(_ MapView:MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?{

    let view = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: "pin")

    view.markerTintColor = .blue

    return view

}
Run Code Online (Sandbox Code Playgroud)

但是,当我启动我的应用程序时,我的默认位置标记会更改为。如何在不更改此标记的情况下更改引脚?查看位置的代码也很简单

 func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
    self.MapView.showsUserLocation = true
}
Run Code Online (Sandbox Code Playgroud)

感谢您的回答!:)

annotations mapkit ios swift swift4

0
推荐指数
1
解决办法
1009
查看次数

标签 统计

annotations ×1

ios ×1

mapkit ×1

swift ×1

swift4 ×1