Hello, everyone.
I work under PDFViewer project and need some advice.
so, i load PDF pages in buffer (max 8), then displays its in ScrollView. And now i need implement one thing that adds pages in buffer (if (pagesInBuffer - currentPage < step)) and delete pages from begining of array, if they are't needed. I implemented tihs in my project, but not all working right.
This is the code :
Code:
if(currentPoint.x == screenWidth){
currentPage += 1;
screenWidth += 768;
[self loadScrollViewWithPage:currentPage];
if(realLastPage - currentPage <= step){
for(int i = 0; i < step; i++){
[myPage loadViewForPage:page cycles:realLastPage + i append:YES filename:filename array:pageArray];
NSLog(@"size of pageArray after adding elements: %d", [pageArray count]);
[pageArray removeObjectsInRange:NSMakeRange(0, step)];
NSLog(@"size of pageArray after deleting elements: %d", [pageArray count]);
}
realFirstPage += step;
}
}
NSLog(@"currentPage: %d", currentPage);
what they are doing :
1. load page with page number.
2. if laspage - currentpage < step load 'step' pages in buffer array.
3. deleting first 2 pages from array.
4. incement out firstpage for displaying right view.
What i forgot to implement. What are not correct.
Maybe i must make scroll.content size bigger?
P.S. thanks
P.S. and sorry, if in text you found gramatic mistakes.