Google Maps API-标记群集样式会阻止图像显示?

时间:2019-02-26 13:01:35

标签: javascript google-maps cluster-computing marker

我遇到一个问题,尝试更改标记群集上的字体大小和颜色,但是添加样式会阻止图像显示?如果我注释掉样式部分,则图像显示正确。

//Declare variable 
 NSInteger currentPageNumber;

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == arrData.count-1) {
         currentPageNumber++;
         //Call your Webservice
     }
}

-(void)webserviceCall{
    //pass page number in your web service you will get data with page number 
   // After getting data from web service you need to add data in your array, so you will have total records. 
 if([[jsonResponse objectForKey:@"status"] intValue] == 1){
      [arrData addObjectsFromArray:arrData];
    }

  }

如何将样式添加到标记中,但要保留正在使用的图像?

2 个答案:

答案 0 :(得分:0)

根据上述克里斯蒂安·科瓦切夫的建议解决。

new MarkerClusterer(this.map, this.map_markers, {
    styles:[{
        url: site_settings.template_directory + '/assets/images/marker-clusterer/m1.png',
        textSize: 12,
        width: 42,
        height: 42,
        textColor: 'white'
    }],
    maxZoom: this.map_max_zoom - 1,
    zoomOnClick: true
})  

答案 1 :(得分:0)

根据MarkerCluster库GitHub,样式对象需要一个 URL ,该URL会覆盖 imagePath

解决方案:

{"id":"S:\\Docs\\forIndexing\\indexThisFile_001.pdf",
 "URL":{"set":"https//localhost/urlToFiles/indexThisFile_001.pdf:"}
}