Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply filter over UIView/UIWindow to modify underlying view rendering

I'm trying to make a "dark mode" for my app, and I'd like to do it in a really easy way. Is there any way to apply a filter or create another view over my other views so that they appear inverted - much like "Accessibility" on iOS 3.2+? I know that Core Image filters don't work on iPhone, but that's not a big deal to me - as long as there's a way to apply a different sort of filter.

Is this feasible on iPhone? How does Apple do it?

like image 864
Peter Hajas Avatar asked Dec 20 '10 20:12

Peter Hajas


1 Answers

It sounds like you're thinking of placing a semi-transparent view filled with a dark color over your entire user interface. If that's the case, then you should read Forwarding Touch Events for a discussion of the issues involved.

Another way to do it is to change the set of colors and images that you use to draw your views.

Both these schemes will be easier and work better if you're dealing with custom views. If you're using an overlay, the document linked above explains that the standard UI elements don't take kindly to event forwarding. If you change colors, well... depending on what UI elements you're using, it may or may not be possible to substitute your own images and colors.

like image 55
Caleb Avatar answered Oct 20 '22 14:10

Caleb