views:

285

answers:

3

i have one trouble, me need make scrollview with content of pdf(pages), this content has size of first 8 pages, and when i already see 8 page, i need expand content size for new pages and to do so, that scrollview show me new pages, but he shows pages from start scrollview again.

What i need to implement?

A: 

Maybe what you're looking for is setContentOffset.

Erik B
if i implement setContentOffset, my scroller begin scroll from first page, not from current page.
kenshin
You need to set the content offset to your current page.
Erik B
Show me how you implemented setContentOffset and I'll see if I can tell you what's wrong.
Erik B
A: 
if(currentPoint.x == screenWidth){

    currentPage += 1;
    screenWidth += 768.0f;

    [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]);
            NSLog(@"page # added: %d", realLastPage + i); 

            //[pageArray removeObjectsInRange:NSMakeRange(0, step)];
            //NSLog(@"size of pageArray after deleting elements: %d", [pageArray count]);

        }
        realFirstPage += step;
        contentInstep += step;
        scroller.contentInset = UIEdgeInsetsMake(0, 0, 0, kScrollObjWidth * contentInstep);
        NSLog(@"real first page: %d; contentInstep: %d", realFirstPage, contentInstep);

    }
}

NSLog(@"currentPage: %d", currentPage);

it's code, now i try implement scroller.contentInset to expand my scroller content size.

kenshin
A: 

I'll reiterate what Erik B said: Make the scroll view as big as it needs to be in the first place, and load pages on demand.

tc.