Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place Xib on google map as Marker instead of google map marker icon

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

like image 259
Parth Dhorda Avatar asked Jul 24 '17 10:07

Parth Dhorda


People also ask

Can you put markers on Google Maps?

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.

What is the Google map marker called?

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 .


1 Answers

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
like image 73
PGDev Avatar answered Oct 11 '22 00:10

PGDev