Josh Schärer
Josh Schärer

Reputation: 153

How can I make the camera stop animating to updatedLocation, when user interacts?

Imagine you are in a car right now and you are driving fast, so the camera follows the location and updates in seconds. But if you would like to scroll and see other places on the map it doesn't work, because you will get instantly back to the updated Location.

So that's why I am asking how to stop the camera from following the updated location when the user scrolls. And in addition, I would also like that the camera starts following the current location again when the user presses the myLocationButton.

Upvotes: 1

Views: 776

Answers (1)

Pushpendra
Pushpendra

Reputation: 986

follow this link and stop updating camera when you tap on map and start updating when you again tapped on my location

https://developers.google.com/maps/documentation/ios-sdk/events

use this delegate method to reset the camera :-

public func didTapMyLocationButton(for mapView: GMSMapView) -> Bool {}

this can be used to stop camera if you are using marker

 func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
        self.mapview.selectedMarker =  marker
 return true
}

Upvotes: 1

Related Questions