使用了百度地图的SDK,定位图片一直是蓝色的小圆点,很不喜欢,想换成自定义的图片,在网上搜罗了一大通,找到了解决的方案。

  写下如下代码:

1
2
3
4
5
6
7
8
9
//定位图层自定义样式参数
    BMKLocationViewDisplayParam *displayParam = [BMKLocationViewDisplayParam new];
    displayParam.isRotateAngleValid =YES;
    displayParam.isAccuracyCircleShow =YES;
    displayParam.locationViewImgName = @"icon_map_location";
    displayParam.locationViewOffsetX =0;
    displayParam.locationViewOffsetY =0;
     
    [_mapView updateLocationViewWithParam:displayParam];

 locationViewImgName后面是你想要换成的图片的名字。重点来了,要把你的图片存放的位置放在mapapi.bundle/images文件下就可以实现替换功能了。

 

参考:

https://www.cnblogs.com/fangwenkai/p/5592332.html

 
posted on 2025-05-30 08:59  懂事长qingzZ  阅读(35)  评论(0)    收藏  举报