使MKMapView的背景颜色变暗而不会使MKOverlay变暗

如何使MKMapView的背景颜色变暗,而不是同时使MKMapViewMKOverlay变暗 – 类似于Nike +应用程序中的地图视图。

好的,我在这里得到了解决方案,在将其他叠加层添加到地图之前,您可以将总叠加层添加为地图的背景,因此地图的背景颜色会发生变化,但叠加层仍然像以前一样,这里是代码

 MKMapRect worldRect = MKMapRectWorld; MKMapPoint point1 = MKMapRectWorld.origin; MKMapPoint point2 = MKMapPointMake(point1.x+worldRect.size.width,point1.y); MKMapPoint point3 = MKMapPointMake(point2.x, point2.y+worldRect.size.height); MKMapPoint point4 = MKMapPointMake(point1.x, point3.y); MKMapPoint points[4] = {point1,point2,point3,point4}; self.polygon = [MKPolygon polygonWithPoints:points count:4]; [self.runMapView addOverlay:self.polygon]; 

Swift 2.0

 let worldRect = MKMapRectWorld let point1 = MKMapRectWorld.origin let point2 = MKMapPointMake(point1.x + worldRect.size.width, point1.y) let point3 = MKMapPointMake(point2.x, point2.y + worldRect.size.height) let point4 = MKMapPointMake(point1.x, point3.y) var points = [point1, point2, point3, point4] let polygon = MKPolygon(points: &points, count: points.count) mapView.addOverlay(polygon)