I'm using the the below github project
https://github.com/jackhumphries/UIPageViewController-PDF
the problem is pdf is loading and page curl effect is working but i can not zoom in and zoom out my pdf document that is loaded i try debuging as well then why its not working but i can not find out the solution and i checked out the PDFScrollView delegate methods they all are implemented but those methods are not calling when i try to zoom in/out .
here are these methods :
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.tiledPDFView;
}
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
{
// Remove back tiled view.
[self.oldTiledPDFView removeFromSuperview];
// Set the current TiledPDFView to be the old view.
self.oldTiledPDFView = self.tiledPDFView;
[self addSubview:self.oldTiledPDFView];
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
{
// Set the new scale factor for the TiledPDFView.
_PDFScale *= scale;
// Calculate the new frame for the new TiledPDFView.
CGRect pageRect = CGPDFPageGetBoxRect(_PDFPage, kCGPDFMediaBox);
pageRect.size = CGSizeMake(pageRect.size.width*_PDFScale, pageRect.size.height*_PDFScale);
// Create a new TiledPDFView based on new frame and scaling.
TiledPDFView *tiledPDFView = [[TiledPDFView alloc] initWithFrame:pageRect scale:_PDFScale];
[tiledPDFView setPage:_PDFPage];
// Add the new TiledPDFView to the PDFScrollView.
[self addSubview:tiledPDFView];
self.tiledPDFView = tiledPDFView;
}
And i have this code :
-(id)initWithPDFAtPath:(NSString *)path {
NSURL *pdfUrl = [NSURL fileURLWithPath:path];
PDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)pdfUrl);
totalPages = (int)CGPDFDocumentGetNumberOfPages(PDFDocument);
self = [super initWithNibName:nil bundle:nil];
return self;
}
and i want to implement this code below to above code
/*
Open the PDF document, extract the first page, and pass the page to the PDF scroll view.
*/
NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"TestPage" withExtension:@"pdf"];
CGPDFDocumentRef PDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)pdfURL);
CGPDFPageRef PDFPage = CGPDFDocumentGetPage(PDFDocument, 1);
[(PDFScrollView *)self.view setPDFPage:PDFPage];
CGPDFDocumentRelease(PDFDocument);
Add this method to PDFScrollView:
and add the last two lines to
scrollViewDidEndZooming
Notice that changing page will only work when the page is at its lowest zoom level (as in happens in several reader apps).