Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom user location dot in Google maps for iOS (GMSMapview)

  1. Is there an official way to set a custom user location dot in Google maps for iOS (GMSMapView)?
  2. Is there a known way to "hack" it? Like iterating through all subviews and layers and fish the blue dot?
  3. Even if you can't customise its appearance, can you control its z order index? When you have many markers, the little blue dot becomes hidden, and sometimes you want it to be visible at all times.

Thanks

like image 215
mllm Avatar asked Jun 23 '15 09:06

mllm


2 Answers

You can try to find the image on:

GoogleMaps.framework > Resources > GoogleMaps.bundle OR GoogleMaps.framework > Resources > GoogleMaps.bundle > GMSCoreResources.bundle

I did a quick search on those and the only associated file I found with that blue dot is GMSSprites-0-1x.

Please read the google maps terms and conditions because this might not be legal.

like image 51
apinho Avatar answered Sep 28 '22 00:09

apinho


You can set the maps myLocationEnabled to NO. That will hide the default location dot. Then use an instance of CLLocationManager to give you your position. Inside CLLocationManager didUpdateLocations method you can set a custom GMSMarker. Set its icon property to whatever you want your dot to look like using [UIImage imageNamed:]. This will allow you to achieve the desired effect.

like image 23
i2Fluffy Avatar answered Sep 28 '22 00:09

i2Fluffy