Using images in iOS is a constant balancing act between making beautiful UIs and managing the size of your app’s bundle. This talk will go over some things you can do with images to help that balance.
while your app is launching • One for each resolution/rotation • Separate image for iPhone 5 • The presence of this image indicates whether your app has iPhone 5 support
in points, not pixels • To get the pixel dimensions of an image, multiply scale by size • Images created with +imageNamed: automatically seek out image files with the “@2x” suffix before the extension • “image.png” and “[email protected]”
create a resizable version that can resize to any arbitrary size • - (UIImage *)resizableImageWithCapInsets: (UIEdgeInsets)capInsets; • The inner portion is tiled or stretched
image repeat, such as in a background • Create a UIColor object with the image as a pattern: UIColor *myPatternColor = [UIColor colorWithPatternImage:myImage]; • Great way to save space
over interpolation quality • Bad solution: multiple images in the bundle, resized to the necessary sizes • How can we resize an image with good quality?
image effects, analogous to Photoshop layer styles • Renders UI into image, caches heavily • Allows for small bundle sizes, rendered-on- demand UI • Soon to be open-sourced