There’s two simple class methods to draw noise:
+ (void)drawNoiseWithOpacity:(CGFloat)opacity; + (void)drawNoiseWithOpacity:(CGFloat)opacity andBlendMode:(CGBlendMode)blendMode;
David even provides a UIView or NSView (depending on which platform you’re building for) subclass that wraps up this behavior nicely. Here’s the interface:
@property (strong, nonatomic) NSColor/UIColor *backgroundColor; @property (nonatomic) CGFloat noiseOpacity; @property (nonatomic) CGBlendMode noiseBlendMode;
Since NSView doesn’t have a
backgroundColor property, he adds one for you. Super handy.
Lots of designs, including Apple’s, have been using noise lately. KGNoise makes it dead simple to accomplish this now. Definitely give it a look!