What i want is I want to fix the marker position to the centre of my map view. when map moves still my marker should stick to that centre point. Code for marker is shown below:
var pin:GMSMarker = GMSMarker(position: CLLocationCoordinate2DMake(currentLocation.coordinate.latitude, currentLocation.coordinate.longitude))
pin.icon = UIImage(named: "img_map_pin")
pin.map = mapView?
pin.infoWindowAnchor = CGPointMake(0.44, 0.44)
mapView?.selectedMarker = pin
I want to make same as Uber has done. When map moves marker is in centre and after map stops moving I get that point's address from map.
Assign GMSMapViewDelegate to class and add below code
func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {
pin.position = position.target
}
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