如何使MKMapView
的背景颜色变暗,而不同时使MKOverlay
的MKMapView
变暗-类似于Nike +应用中的 map View 。
最佳答案
好的,我在这里有了解决方案,在向 map 添加其他叠加层之前,您可以将总叠加层添加为 map 的背景,这样 map 的背景颜色就会更改,但是叠加层仍然是以前的样子,这里有代码
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];
关于ios - 使MKMapView的背景颜色变暗而不使MKOverlay变暗,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16227884/