Need help with JMNoise?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jasonmorrissey
192 Stars 15 Forks Other 7 Commits 4 Opened issues

Description

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.

Services available

!
?

Need anything else?

Contributors list

# 171,926
Objecti...
7 commits

UIView+JMNoise

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:

Usage

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.

Customization

If you need a little bit more control over how

applyNoise
operates, the following methods are also exposed for your convenience:

applyNoiseWithOpacity:

and

applyNoiseWithOpacity:atLayerIndex:

... 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:
-(void)drawRect()
{
    // 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:]

Installation

All you need to do is import

UIView+JMNoise.h
and make sure that you have the QuartzCore framework linked to your target.

License

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.