I am doing a project where I am adding the marker on to the google map but I wants to add the custom marker of Xib like I want to add my custom view onto the map instead of marker.icon default of google map
I have made a uiview where I will download the image from the and then wants to place that UIView on the Map
You can add a simple marker to the map at a desired location by instantiating the marker class and specifying the position to be marked using latlng, as shown below.
Jens Rasmussen, one of the inventors of Google Maps, a Danish computer programmer is credited with the creation of what is officially known as the map pin or pushpin .
For custom view as marker, you can use iconView
of GMSMarker
.
- (UIView*) iconView
Marker view to render. If left nil, falls back to the icon property instead. Supports animation of all animatable properties of UIView, except frame and center. Changing these properties or their corresponding CALayer version, including position, is not supported. Note that the view behaves as if clipsToBounds is set to YES, regardless of its actual value.
For more refer to: https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_marker.html#aa16a89bd5187e64e71c57c31c150a44d
Just set your custom view as the iconView
of your marker.
let marker = GMSMarker()
marker.iconView = UIView() //Your custom view here
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