Ich möchte den blauen Punkt auf der Karte darstellen, der den Standort des Benutzers darstellt.So zeigen Sie den Benutzerstandort im Google Maps iOS SDK an
Ich habe versucht, es so zu tun:
override func viewWillAppear(animated: Bool) {
self.mapView.addObserver(self, forKeyPath: "myLocation", options: NSKeyValueObservingOptions.New, context: nil)
}
deinit {
self.mapView.removeObserver(self, forKeyPath: "myLocation")
}
override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
if keyPath == "myLocation" {
self.mapView.animateToLocation((object?.myLocation!!.coordinate)!)
self.mapView.animateToZoom(17)
}
}
aber observeValueForKeyPath(keyPath: ofObject: change: context:)
nicht genannt und ich, warum nicht verstehen kann.
Vielen Dank!
und die MyLocation Eigenschaft des GMSMapView zeigt, wo der Benutzer Lage dot wird gezogen wird (wenn myLocationEnabled wahr ist). – lucianoenrico