1

我遇到一个错误:

无法使用类型为“(中心:CLLocationCoordinate2D,半径:int,标识符:字符串)”的参数列表调用类型“MKCircle”的初始化程序

    let region = CLCircularRegion(coder: MKCircle(center: CLLocationCoordinate2DMake(self.destLat!, self.destLong!), radius: 100, identifier: destinationAddress))
    self.locationManager .startMonitoring(for: region)

下面是我的叠加方法

 func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {

   if overlay is MKCircle {
        let circleRenderer = MKCircleRenderer(overlay: overlay)
        circleRenderer.lineWidth = 1.0
        circleRenderer.strokeColor = .purple
        circleRenderer.fillColor = UIColor.purple.withAlphaComponent(0.4)
        return circleRenderer
    }

    let myLineRenderer = MKPolylineRenderer(polyline: myRoute.polyline)
    myLineRenderer.strokeColor = UIColor.blue
    myLineRenderer.lineWidth = 3
    return myLineRenderer
}
4

1 回答 1

0

不知道你想做什么,但你的声明region是错误的。这是正确的版本:

let region = CLCircularRegion(center: CLLocationCoordinate2DMake(self.destLat!, self.destLong!), radius: 100, identifier: destinationAddress)
于 2017-02-13T14:46:12.747 回答