如何显示iOS中的所有信息窗口谷歌地图不用点击标记? [英] How to show all Info window in iOS Google maps without tapping on Marker?

查看:105
本文介绍了如何显示iOS中的所有信息窗口谷歌地图不用点击标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建标记而不点击。但我不能显示所有的infoWindows。它只在最后一个标记上显示一个infowindow。

I'm trying to create markers without tapping. But i cant display all infoWindows. It only show one infowindow on last marker.

以下是我的代码:

Here is my code:

- (void)viewDidLoad {
    [super viewDidLoad];
    NSMutableArray *markersArray = [[NSMutableArray alloc] init];
    for(int i=0; i<10; i++){
        GMSMarker *marker = [[GMSMarker alloc] init];
        marker.position = CLLocationCoordinate2DMake(latitude, longitude);
        marker.appearAnimation=YES;
        marker.opacity = 0.0;
        mapView.selectedMarker = marker;
        marker.map = mapView;
        [markersArray addObject:marker];
    }
}

和自定义Infowindow:

and custom Infowindow:

- (UIView*)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
    CustomInforwindow *customView =  [[[NSBundle mainBundle] loadNibNamed:@"CustomInforwindow" owner:self options:nil] objectAtIndex:0];
    return customView;
}


推荐答案

一次。

mapView.selectedMarker = marker; this will open the infowindow for the last marker

如果你想显示多个标记,那么你应该使标记它包含标记和信息窗口。

If you want to show multiple markers then you should make marker that contains both the marker and the info window .

希望这有助于您。

这篇关于如何显示iOS中的所有信息窗口谷歌地图不用点击标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆