为当前位置自定义Google地图蓝点 [英] Customize Google Maps blue dot for current location

查看:223
本文介绍了为当前位置自定义Google地图蓝点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是适用于iOS的2013版Google地图SDK。我想用另一个图标或周围的脉冲圈定制当前位置的默认蓝点。



我知道我们可以用 mapView: viewForAnnotation:在MKMapView中,但我不知道如何使用Google地图。

解决方案

无法使用当前版本的SDK(1.4.3)执行此操作,实际上,此请求存在未解决的问题: Look here



作为解决方法,您可以隐藏默认按钮:

  _map.myLocationEnabled = NO; 

然后创建一个自定义 GMSMarker

  GMSMarker * pointMarker = [GMSMarker markerWithPosition:currentPosition]; 
pointMarker.icon = [UIImage imageNamed:@YourImage];
pointMarker.map = _map;

使用 CLLocationManager ,所以它总是显示当前位置。这有点棘手,但我认为唯一的办法就是可以实现这一点。如果你需要更完整的例子,请告诉我。

I'm using a 2013 version of Google Maps SDK for iOS. I would like to customize the default blue dot for current location with another icon or pulsing circles around.

I know we can do that with mapView:viewForAnnotation: in MKMapView, but I can't found out how to do it with Google Maps.

解决方案

There is no way to do this with current version of the SDK (1.4.3), and actually there is an open issue with this request: Look here.

As a work around, you can hide the default button with:

 _map.myLocationEnabled = NO;

Then create a custom GMSMarker

 GMSMarker *pointMarker = [GMSMarker markerWithPosition:currentPosition];
 pointMarker.icon = [UIImage imageNamed:@"YourImage"];
 pointMarker.map = _map;

And change the position of it using a CLLocationManager, so it always show the current position. It's a bit tricky but is the only way, I could think, that you can achieve this. If you need a more complete example let me know.

这篇关于为当前位置自定义Google地图蓝点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆