1
をドラッグしながら、私はすべてのannotation
プロパティのみget
ているので、私はそれをドラッグしていながら、私のannotation
タイトルを更新する方法を知りたいです。私が試してみる更新MKPointAnnotationオブジェクト
コード:MKMapViewDelegate
のドラッグ方法で
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, didChange newState: MKAnnotationViewDragState, fromOldState oldState: MKAnnotationViewDragState) {
switch (newState) {
case .starting:
//view.dragState = .dragging
print("dragging.....")
case .ending, .canceling:
// view.dragState = .none
let lat = view.annotation?.coordinate.latitude
let long = view.annotation?.coordinate.longitude
let coordinates = CLLocationCoordinate2D(latitude: lat!, longitude: long!)
print(" pin lat \(lat) long \(long)")
//Error here - title is get only property
view.annotation?.title = "New Location"
default: break
}
}
おかげで男を使用し変更するには!出来た。 – ankit
ようこそ、ハッピーコーディング:) –