使MKMapView的背景颜色变暗而不会使MKOverlay变暗 [英] Darkening the MKMapView's background color without darkening the MKOverlay
本文介绍了使MKMapView的背景颜色变暗而不会使MKOverlay变暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使 MKMapView
的背景颜色变暗, NOT 使 MKOverlay $ c $变暗c>同时在
MKMapView
中 - 类似于Nike + app中的地图视图。
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.
推荐答案
好的,我在这里得到了解决方案,在向地图添加其他叠加层之前,您可以将总叠加层添加为地图的背景,这样地图的背景颜色会发生变化,但是覆盖仍然像以前一样,这里是代码
OK , I got the solution here ,before add other overlays to the map ,you can add a total overlay as a background to the map ,so the map's background color is changed ,but the overlay is still as they are before ,here are codes
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];
这篇关于使MKMapView的背景颜色变暗而不会使MKOverlay变暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文