0

在编写 IOS 设备方面,我是一个新手,我需要一点帮助。我正在尝试创建一个数组,将 GPS 坐标存储为从 a 点到 b 点的驱动器,然后我想使用 MKPolyLine 将它们绘制在地图上。如果有人能给我一些指示,我将不胜感激!谢谢!

4

1 回答 1

1

是的,制作一个位置坐标(纬度,经度)的 NSMutableArray,如下所示:

[arrayOfDesc addObject:[
                        [CLLocation alloc] initWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude]];

然后使用此源代码中的类。使用“NVPolylineAnnotation”和“NVPolylineAnnotationView”类。并通过一个方法传递你的数组:

NVPolylineAnnotation *annotations = [[NVPolylineAnnotation alloc] initWithPoints:arrayOfDesc mapView:_mapView];
[_mapView addAnnotation:annotations];

它真的很简单,你只需要将坐标传递给类,剩下的就是提到的类了 :)

于 2012-04-12T14:19:14.183 回答