I have subclassed UIView object inside a uiscrollview which displays a pdf page. I can zoom that page. But when I do so, the inside view is zoomed and is getting blurred. I understood that the inner view shud be refreshed and i called setNeedsDisplay. But no change have happened and its the same even now. Below is the code for drawRect for the subclassed uiview.
- (void)drawRect:(CGRect)rect
{
if(document)//the pdf document object
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
CGContextTranslateCTM(ctx, 0.00, [self bounds].size.height);
NSLog(@"%f",[self bounds].size.height);
CGContextScaleCTM(ctx, 1.0, -1.0);
CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(page, kCGPDFCropBox,
[self bounds], 0, true));
CGContextDrawPDFPage(ctx, page);
CGContextRestoreGState(ctx);
}
}
Check out the CATiledLayer example provided by the ScrollViewSuite sample code:
http://developer.apple.com/iphone/library/samplecode/ScrollViewSuite/Introduction/Intro.html
The TapToZoom example illustrates a way to get the view to redraw its content when one zooms in. I.e. you need to somehow set your view’s frame to be larger than the screen, or maybe you can also use transforms – however, I never used transforms before.