Skip to content

Instantly share code, notes, and snippets.

@jweinberg
Created June 24, 2011 22:56
Show Gist options
  • Save jweinberg/1045850 to your computer and use it in GitHub Desktop.
Save jweinberg/1045850 to your computer and use it in GitHub Desktop.
- (void)drawRect:(CGRect)rect;
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetBlendMode(ctx, kCGBlendModeCopy);
CGContextDrawImage(ctx, (CGRect){CGPointZero, self.topImage.size}, [self.topImage CGImage]);
CGContextSaveGState(ctx);
CGContextClipToRect(ctx, CGRectMake(0, self.topImage.size.height, self.bounds.size.width, self.bounds.size.height - self.topImage.size.height - self.bottomImage.size.height));
CGContextDrawTiledImage(ctx, (CGRect){CGPointZero, self.middleImage.size}, [self.middleImage CGImage]);
CGContextRestoreGState(ctx);
//
// CGContextDrawImage(ctx, (CGRect){CGPointMake(0, self.bounds.size.height - self.bottomImage.size.height), self.bottomImage.size}, [self.bottomImage CGImage]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment