我在 mapView 上放置标记。标记显示来自 JSON 填充的 NSArray 中的对象。现在,如果用户点击一个标记,它会打开一个信息窗口,其中显示来自数组的两个字段(键)的文本。我需要在信息窗口中放置一个按钮。如果用户点击按钮,则必须打开包含有关所选对象的更多信息的详细视图控制器。
这是将标记放在 mapView 上的代码:
for ( int i=0;i<[categorias count];i++){
GMSMarker *marker = [[GMSMarker alloc] init];
double latitud = [[[categorias objectAtIndex:i] objectForKey:@"latitudEmpresa"] doubleValue];
double longitud = [[[categorias objectAtIndex:i] objectForKey:@"longitudEmpresa"]doubleValue];
marker.position = CLLocationCoordinate2DMake(latitud, longitud);
NSString *nombre = [[categorias objectAtIndex:i] objectForKey:@"nombreEmpresa"];
marker.title = nombre;
NSString *direccion = [[categorias objectAtIndex:i] objectForKey:@"direccionEmpresa"];
marker.snippet = direccion;
marker.map = mapView_;
}