2015-11-01 126 views
0

我在我的MapView上有一個多邊形,現在我想添加一個2,但使用不同的顏色。 有沒有辦法待辦事項?Swift MapKit多邊形覆蓋

這是MapView的地方應該是在不同的顏色 enter image description here

func addBoundry() 
    { 
     var points=[ 
        CLLocationCoordinate2DMake(51.711963, 8.738251), 
        CLLocationCoordinate2DMake(51.711963, 8.763717), 
        CLLocationCoordinate2DMake(51.718574, 8.763717), 
        CLLocationCoordinate2DMake(51.71855, 8.754448)] 

     let polygon = MKPolygon(coordinates: &points, count: points.count) 

     mapView.addOverlay(polygon) 
    } 

func mapView(mapView: MKMapView!, rendererForOverlay overlay: MKOverlay!) -> MKOverlayRenderer! { 
    if overlay is MKPolygon { 
     let polygonView = MKPolygonRenderer(overlay: overlay) 
     polygonView.fillColor = UIColor(red: 0, green: 0.847, blue: 1, alpha: 0.25) 

     return polygonView 
    } 

    return nil 
} 

一個2多邊形疊加有沒有辦法待辦事項一個呢?

回答

1

通過.title解決以便在if中使用它