IOS Tips
Tile a background image in a UIViewController
<geshi lang="C">
// tile background UIImage *wave = [UIImage imageNamed:@"background-dots.png"]; CGSize imageViewSize = imageView.bounds.size; UIGraphicsBeginImageContext(imageViewSize); CGRect imageRect; imageRect.origin = CGPointMake(0.0, 0.0); imageRect.size = CGSizeMake(wave.size.width, wave.size.height); CGContextRef imageContext = UIGraphicsGetCurrentContext(); CGContextDrawTiledImage(imageContext, imageRect, wave.CGImage); UIImage *finishedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); imageView.image = finishedImage;
</geshi>