How would one darken the MKMapView
's background color, and NOT darken the MKOverlay
in the MKMapView
's at the same time -- similar to the map view in the Nike+ app.
问问题
1931 次
2 回答
7
好的,我得到了解决方案,在添加其他叠加到地图之前,您可以添加一个总叠加作为地图的背景,这样地图的背景颜色就会改变,但是叠加仍然和以前一样,这里有代码
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];
于 2013-10-09T09:26:34.930 回答
1
斯威夫特 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)
于 2015-12-03T09:49:59.890 回答