IBのviewControllerにmapKitを追加しようとしていますが、ナビゲーションコントローラの上を押していますが、サイクルのどこでも注釈を追加しても、遅延が発生してmapKitがレンダリングされないようですすべてを含むスクロールビューは簡単にスクロールしません。例えば、バックグラウンドスレッドでAndroidに似たiOSでこれを行う方法はありますか?Navigation Controllerを押すviewControllerでMapKitを効率的に実装するには?
以下は注釈を追加しなくてもコードであり、レンダリングではまだ遅延が発生しています。私は別の方法があると確信しています。何か案が?
class DetailViewController: UIViewController , MKMapViewDelegate{
override func viewDidLoad() {
super.viewDidLoad()
self.mapView?.delegate = self
}
//changing the annotation
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if (annotation is MKUserLocation) {
return nil
}
let reuseId = "detailMrker"
var anView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId)
if anView == nil {
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
anView?.image = UIImage(named:"location.png")
anView?.canShowCallout = true
}
else {
anView?.annotation = annotation
}
return anView
}
}
実際のコードを表示してください。 – matt