【发布时间】:2014-05-08 07:49:26
【问题描述】:
我使用此代码在 iOS 版 Google 地图上创建标记。
self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.mapView.myLocationEnabled = YES;
self.mapView.accessibilityElementsHidden = NO;
self.mapView.frame = self.view.bounds;
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mapView.delegate = self;
self.mapView.settings.myLocationButton = YES;
[self.view addSubview:self.mapView];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.map = self.mapView;
但我需要标记看起来像这样:
我知道如何使用 Apple Map,但我需要使用 Google Map(因为在某些城市 Apple Map 几乎不显示任何内容)。
对于谷歌地图,我发现只有这样的代码:
marker.icon = image; // image from xib file
所以我需要从 xib 为每个标记创建图像。我会有很多标记,所以可能使用这种方法我会收到内存警告。
有人知道更好的方法来实现这样的标记吗?
【问题讨论】:
-
我认为您需要为许多标记实现集群。
-
你能给出任何链接或代码示例吗? “多个标记的集群”是否有助于仅显示视图标记,还是有助于在标记中显示自定义视图?
标签: ios google-maps google-maps-api-3 gmsmapview