我有个问题。我为 ios 本机代码设置了谷歌地图 API。
我使用的是 Google Maps API 1.4.3 版。
我是自定义marker infoWindow中的一个mark成功。
但我无法设置关于多标记的不同 infoWindow 内容。
有没有人可以指导我,如何将不同的标题和片段传递给 markerInfoWindow 方法?或点击时如何知道标记?
我用一个标记和自定义 markerInfoWindow 部分攻击我的代码。
- (void)viewDidLoad
{
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:25.03760471 longitude:121.5412 zoom:14];
mapView = [GMSMapView mapWithFrame:CGRectMake(0, 0, _mapBackgroundView.frame.size.width,_mapBackgroundView.frame.size.height) camera:camera];
mapView.myLocationEnabled = YES;
mapView.settings.myLocationButton = YES;
mapView.settings.compassButton = YES;
mapView.delegate = self;
[self.mapBackgroundView addSubview:mapView];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(25.03760471, 121.5412);
marker.map = mapView;
GMSMarker *marker2 = [[GMSMarker alloc] init];
marker2.position = CLLocationCoordinate2DMake(25.03760461, 121.5432);
marker2.map = mapView;
}
-(UIView *) mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
{
CustomInfoWindow *infoWindow = [[[NSBundle mainBundle]loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0];
infoWindow.titleLb.text = @"1th marks";
infoWindow.snippetLb.text= @"1th marks snippet~";
return infoWindow;
}
非常感谢~