【问题标题】:iOS google maps add multiple pins on mapiOS 谷歌地图在地图上添加多个图钉
【发布时间】:2017-03-06 06:58:18
【问题描述】:

我使用以下代码在我的应用程序的谷歌地图视图上添加图钉:

 [self.vm.arrValues enumerateObjectsUsingBlock:^(GeoObject*  _Nonnull go, NSUInteger idx, BOOL * _Nonnull stop) {


        CLLocationCoordinate2D circleCenter = CLLocationCoordinate2DMake(go.latitude, go.longitude);
        GMSCircle *circ = [GMSCircle circleWithPosition:circleCenter
                                                 radius:1000];
        circ.fillColor = [[UIColor redColor] colorWithAlphaComponent:0.5] ;
        circ.map = _mapView;
        circ.strokeColor = [UIColor clearColor];

    }];

问题是,我实际上有 1337 个引脚,所以它有点缓慢和滞后。有什么方法可以加快进程吗?

【问题讨论】:

    标签: ios google-maps


    【解决方案1】:

    我通过以下方式解决了问题:

    [self.vm.arrValues enumerateObjectsUsingBlock:^(GeoObject*  _Nonnull go, NSUInteger idx, BOOL * _Nonnull stop) {
    
            GMSGroundOverlay *overlay = [GMSGroundOverlay groundOverlayWithPosition:CLLocationCoordinate2DMake(go.latitude,go.longitude) icon:self.circImg zoomLevel:12 ];
            overlay.map = _mapView;
    
        }];
    

    因为填充颜色会导致性能问题,我找到了一种方法来简单地显示具有特定坐标的图像。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多