UIScrollView setContentSize
-
27-09-2019 - |
문제
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?
해결책
Maybe what you're looking for is setContentOffset.
다른 팁
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.
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.
제휴하지 않습니다 StackOverflow