Reputation: 6608
I have a polygon on my MapView, now i want to add a 2 one but in a different color. Is there a way todo so?
This is the MapView where should be a 2. Polygon overlay in different color
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
}
Is there a way todo so?
Upvotes: 0
Views: 966