A category on UIView to easily apply a noise texture. Uses no external images or dependencies to make it very easy to drop into projects.



This is a category on UIView that makes it very easy to add a noise texture to UIViews. It's performed entirely using Core Graphics so it does not require any additional images to be used in your projects.

How it looks

Here's an example of a UIButton with the applyNoise method applied:


To use the category, you just need to call applyNoise and that's it.

For example:

[myView applyNoise]

I've included a Demo project so that you can jump in and play around with it.


If you need a little bit more control over how applyNoise operates, the following methods are also exposed for your convenience:




... to specify which layer you want to insert the noise. That said, the category will attempt to figure out the best place to insert the noise. (eg. behind text in buttons).

What about drawRects?

If you prefer to draw your noise layer manually within a drawRect(), you can invoke the drawCGNoise method. For example:

    // draw background

    // draw noise texture
    [self drawCGNoise];

    // draw stuff over the noise texture

Similarly, for more control over texture opacity, you can call:

[self drawCGNoiseWithOpacity:]


All you need to do is import UIView+JMNoise.h and make sure that you have the QuartzCore framework linked to your target.


The code used in JMNoise is BSD licensed, so you can freely use it in commercial applications.