MKMapView改变颜色
有人知道更改 MKMapView 颜色的方法吗?有没有一种方法可以对图像进行异或或混合,从而“可能”创建不那么亮的地图的“夜间版本”?
谢谢!
担
Anyone know of a way to change the colors of a MKMapView? Is there a way to XOR an image over or blend one that you could "possibly" create a "night version" of the map that isn't so bright?
Thanks!
Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
更好的解决方案是添加自定义彩色叠加层
better solution would be to add custom colored overlays
我猜你可以创建一个 50% alpha 覆盖 MKMapView 的 UIView,但是这样你就会遇到 UI 问题。我假设 卫星模式不适合?
I guess you could create a UIView with a 50% alpha that covered the MKMapView, but then you will have UI problems. I am assuming the Satellite mode doesn't suit?
我最终做的是添加一个具有 50% 透明黑色背景颜色的 MKAnnotation。然后我将注释移动到由地图视图维护的堆栈的后面,以便所有其他注释仍然可以与之交互。
真正有趣的是地图移动的时候……如果你使用的是 iOS4,那没问题,但在 iOS3 设备上就有点棘手了。好吧,我最终想通了。
What I ended up doing is adding a MKAnnotation with a 50% transparent black background color. Then I moved the annotation to the back of the stack maintained by the mapview, so that all the other annotations can still be interacted with.
Where it really gets interesting is when the map moves... OK if you are on iOS4 but a little tricky on iOS3 devices. Well, I figured it out eventually.
我同意@RolandasR,您可以尝试创建自定义叠加层,如这个答案 https://stackoverflow.com/a/13592117/3847
I agree with @RolandasR, you can try creating a custom overlay as in this answer https://stackoverflow.com/a/13592117/3847