2017-02-13 59 views
1

圈覆蓋我遇到了一個錯誤:收到錯誤嘗試應用在迅速3

不能調用類型「MKCircle」初始型中心「(參數列表:CLLocationCoordinate2D,半徑:INT,標識符:字符串)」

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

下面是我ovelay方法

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 
} 

回答

0

不知道你想要做什麼,而是你的region聲明是錯誤的。 這是正確的版本:

let region = CLCircularRegion(center: CLLocationCoordinate2DMake(self.destLat!, self.destLong!), radius: 100, identifier: destinationAddress) 
+0

我想要在該位置應用圓形覆蓋圖,我該怎麼做? –