I need to get a callback from GMSMapView when it stopped moving.
I have read the documentation and i have found "mapView:idleAtCameraPosition:" method, but it's not quite what i'm looking for. This method gets called too often, not just when the mapView did end moving.
Any idea?
Add a boolean to track whether the map has started being dragged. Then on mapView:willMove: set it to true. In idleAtCameraPosition, only update if this variable is true:
func mapView(mapView: GMSMapView!, idleAtCameraPosition position: GMSCameraPosition!) {
if locationDragged == true {
locationDragged = false
println("changed position: \(mapView.camera.target)")
// do stuff
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With