UIScrollView setContentSize

时间:2010-08-09 08:15:54

标签: iphone pdf uiscrollview scrollview

我有一个麻烦,我需要制作带有pdf(页面)内容的scrollview,这个内容有前8页的大小,当我已经看到8页时,我需要扩展新页面的内容大小,这样做,滚动视图显示我的新页面,但他再次显示从滚动视图开始的页面。

我需要实施什么?

3 个答案:

答案 0 :(得分:0)

也许您正在寻找的是setContentOffset。

答案 1 :(得分:0)

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);

它是代码,现在我尝试使用scroller.contentInset来扩展我的滚动条内容大小。

答案 2 :(得分:0)

我将重申Erik B所说的内容:使滚动视图尽可能大,并根据需要加载页面。