0
アプリケーションのダウンロード 'moreViewController'のサーバーからの緯度と経度私はラベルを持っています。ピンをタップすると、このラベルの正しい緯度または経度(および別のビューからイメージ)をどのように変換できますか?MKMapViewDelegate + JSON ALAMOFIRE
{
"latitude": 40.9233,
"longitude": 20.000,
"image" : "xxxx.xxx/xxx.jpg"
}
{
"latitude": 50.9233,
"longitude": 19.320,
"image" : "xxxx.xxx/yyy.jgp"
}
だから私は今、右のボタンを追加し、次のビューにして
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
self.performSegue(withIdentifier: "more", sender: self)
}
var annotationIdentifier = ""
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
var view = mapView.dequeueReusableAnnotationView(withIdentifier: annotationIdentifier)
if view == nil {
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: annotationIdentifier)
view?.canShowCallout = true
view?.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
} else {
view?.annotation = annotation
}
return view
}
var selectedAnnotation: MKPointAnnotation!
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.destination is moreViewController {
print("123")
let destViewController:moreViewController = segue.destination as! moreViewController
destViewController.lat = "\(latTest)"
}
}
ありがとうございます。 – k0le
@ k0le Welcome mate :) –
申し訳ありませんが、私は見ていない別の質問がありますが、この "場所"はjsonのStringとidの文字列として自分の名前を持っています。 – k0le