Ali Rezaei
Ali Rezaei

Reputation: 753

I want to fix the marker in the center of the map ios

I want to fix the marker in the center of the google map in Swift and I do not want to use CMSCircle i want to fix the marker in the center and move map and marker not change place

Upvotes: 0

Views: 1453

Answers (1)

Nyakiba
Nyakiba

Reputation: 862

You can add this extension to your view controller .The marker will move to the centre every time you move the map

extension MyMapViewController: GMSMapViewDelegate{
    func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
        marker.position = position.target
        reverseGeocodeCoordinate(coordinate: position.target)
    }
}

Upvotes: 1

Related Questions