Sam Soffes changelog.com/posts

KGNoise — The easiest way to draw noise in Objective-C

Today David Keegan released KGNoise. It’s hands down the simplest way to draw noise on iOS or Mac.

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!


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00