简体   繁体   English

如何在Swift iOS中使用PolyLine在两个坐标之间绘制路径

[英]How to use PolyLine to draw path between two coordinates in Swift iOS

This method is mentioned and explained in apple's documentation. 苹果文档中提到并解释了此方法。 Can someone guide me on how to use it ? 有人可以指导我如何使用它吗?

 convenience init(coordinates coords: CMutablePointer<CLLocationCoordinate2D>, count: Int)

You could use it like this: 可以这样使用它:

let c1 = CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0)
let c2 = CLLocationCoordinate2D(latitude: 1.0, longitude: 1.0)
var a = [c1, c2]

var polyline = MKPolyline(coordinates: &a, count: a.count)

I can't see a "Swifter" way to create MKPolylines in the docs... I assume they are still building the bridge, here. 我看不到在文档中创建MKPolylines的“快捷方式” ...我认为他们仍在这里架桥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM