I have an MKMapView and am adding an overlay (MKOverlay) to it.
I would like the overlay to make the map view underneath to appear black & white (i.e. monochrome). Is there any way of doing this?
(I guess I could make the overlay translucent black/gray, but that’s not the exact effect I would like.)
System details: developing an iOS 5 app in Xcode 4.2.
The most proper route, which sadly isn’t yet available on iOS would be:
Your
MKOverlayis at some point being used to create anMKOverlayView, which will have aCALayeras it descends fromUIView. You can attachCIFilters ascompositingFilters toCALayers, which dictate how the view is composited with the background. You could attach a filter of typeCIColorMonochrometo that.Because that option isn’t available, you’re going to have to leap through some major hurdles to do the work for yourself. You’ll probably need to implement your own custom
MKOverlayViewthat in itsdrawViewuses the techniques given in Apple’s QA1703 to get the pixel contents of the map view in the relevant area (be careful not to end up in an infinite recursive loop though), transform those into black and white and present them as your view.Is that something it’s worth investigating further or would you be happier to substitute the effect than to really delve into this stuff?