【发布时间】:2013-06-21 07:10:21
【问题描述】:
我在 ios 应用程序中使用 google maps sdk,我在 mapview 上添加了一组标记。 要添加到地图视图的标记数量过多,因此在将标记加载到地图上时会阻塞 UI。 有没有其他方法可以将标记添加到不会阻塞 UI 的地图上? 这就是我将标记添加到地图视图的方式。
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = location;
marker.icon = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"png"]];
marker.title = title;
marker.animated = animated;
marker.tappable = tappable;
marker.map = _mapView;
使用 for 循环迭代上述代码集,并创建标记并将其添加到地图中。
谢谢。
【问题讨论】:
-
比如说在谷歌地图中一次性添加了 1000 个标记。
-
地图视图不是“线程安全”的,因此虽然可以在 bg 线程上加载图标,但无法在此处添加标记
标签: iphone ios objective-c google-maps google-maps-sdk-ios