我是 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;
}
如图所示
如何添加点击诺贝尔医院时的 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/