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

标签 ios objective-c google-maps

我是 iOS 新手,我遇到了关于向 Google map 标题添加操作的问题

我正在使用这样的代码

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;
}

如图所示

enter image description here

如何添加点击诺贝尔医院时的 Action 。

最佳答案

实现GMSMapViewDelegate方法

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

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

相关文章:

ios - 如何修复链接器错误 "Undefined symbols for architecture i386 from: "_current_task""?

objective-c - 在 Objective-C 中向 NSTableView 添加/删除行

objective-c - 初始化 NSTableView

ios - XCode iOS7 - 带有 UITextView 的动态单元格(如提醒应用程序)

javascript - 谷歌地图 : Can't get InfoWindow to display

ios - 将 NSDictionary 传递给函数以添加对象/键,但在 main() 中显示为空

ios - 配置文件已过期

IOS:如何在 Swift 中增加 AVAudioPlayer 的低音和高音?

javascript - 如何在Angular2中调用Polymer元素方法?

android - 删除折线谷歌地图 v2 android 的问题