我是iOS的新手,因此遇到有关在Google Maps标题中添加操作的问题

我正在使用这样的代码

for (int i=0; i<NameHSArray.count; i++) {
    double LatitudeDouble = [LatitudeHSArray[i] doubleValue];
    double LongitudeDouble = [LongitudeHSArray[i] doubleValue];
    CLLocationCoordinate2D position = CLLocationCoordinate2DMake(LatitudeDouble, LongitudeDouble);
    GMSMarker *marker = [GMSMarker markerWithPosition:position];
    marker.title = NameHSArray[i];

    if([TypeHSArray[i] isEqualToString:@"ESIC"])
    {
        marker.icon = [UIImage imageNamed:@"mapicon2.png"];
    }
    else
    {
        marker.icon = [UIImage imageNamed:@"mapicon1.png"];
    }

    GMSCameraUpdate *zoomCamera = [GMSCameraUpdate zoomIn];
    [mapView animateWithCameraUpdate:zoomCamera];

    marker.map = mapView;
}


如图中

ios - 如何在Objective C中对Google Maps maker的标题添加操作-LMLPHP

单击诺贝尔医院时如何添加操作。

最佳答案

实现GMSMapViewDelegate方法

- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker {
    // your click action
}

关于ios - 如何在Objective C中对Google Maps maker的标题添加操作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42486549/

10-09 17:59