【发布时间】:2017-07-16 06:07:09
【问题描述】:
我正在使用最新的 iOS 谷歌地图 API 绘制折线。我正在逐点构建折线,但它没有正确渲染,因为当我从地图中缩小折线消失(不是字面意思)时,当我放大它时,它只显示了这条线。
这是我绘制折线的函数
RCPolyline *polyline = [[RCPolyline alloc] init];
[polyline drawPolylineFromPoint:self.selectedEmployee.location toPoint:location];
我已经覆盖 init: 让 RCPolyline 变成这样
- (instancetype)init {
self = [super init];
if (self) {
self.strokeWidth = 5.0f;
self.strokeColor = UIColor.redColor;
self.geodesic = YES;
self.map = [RCMapView sharedMapView];
}
return self;}
drawPolylineFromPoint:toPoint: 会这样做
- (void)drawPolylineFromPoint:(CLLocation *)pointX toPoint:(CLLocation *)pointY {
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:pointX.coordinate];
[path addCoordinate:pointY.coordinate];
self.path = path;}
【问题讨论】:
-
我猜你的折线路径数据太多了。
-
@wf9a5m75 和这有什么关系?
-
路径的绘制点使用内存。很多点意味着适用于 iOS 的 Google Maps SDK 使用大量内存。我想这就是原因。为了减少你的分数,你可以对你的路径进行编码。在这里查看stackoverflow.com/questions/30393067/…
-
@wf9a5m75 我解决了我的问题,我提供了我出错的答案,但感谢您的意见。
标签: ios objective-c google-maps google-maps-api-3