Under the Bridge

UIImage+Sprite

Here’s a nifty trick for using sprite sheets for your UIKit graphics that never occurred to us:

UIImage-Sprite-Additions

Useful UIImage category for handling sprite sheets. This add-on smoothes the way of extracting images from a sprite sheet (texture atlas).

This can be useful in UIImageView animations where animationImages array has to be filled with a set of images representing frames. UIImage-Sprite category makes this process trivial…

The basic trick is to get a CGImageRef with CGImageCreateWithImageInRect you then pass to [UIImage imageWithCGImage:]. Simple once it occurs to you!

h/t: @cocoacontrols

1