I've recently asked a question about clipping an image via path at view's drawRect method.
http://stackoverflow.com/questions/2570653/iphone-clip-image-with-path
Krasnyk's code is copied below.
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef path = CGPathCreateMutable();
//or for e.g. CGPathAddRect(path, NULL, CGRectInset([self bounds], 10, 20));
CGPathAddEllipseInRect(path, NULL, [self bounds]);
CGContextAddPath(context, path);
CGContextClip(context);
CGPathRelease(path);
[[UIImage imageNamed:@"GC.png"] drawInRect:[self bounds]];
}
It works very well. However, when my image is larger than the view itself, how do I show different parts of the image?
I tried tweaking around with translation on the locations (show as bounds above) of ellipse and/or UIImage drawInRect but some complex effects (Unwanted clipping, weird elipse size) I can't explain happens.