I implemented a paging UIScrollView. Therefore I have got 5 subviews on my scrollview. To have a nice effect I set up a little offset to every subview so that on the first page, you can see a little bit of the second page at the right side of the ipad. The same effect on the other pages, so everytime you are on a page you have got a little preview on the left/right side of your screen. The scrolling between pages works perfect, but the problem is, that at the first time, the preview isn't loaded. I got a textview on every subview, but it loads first after I scroll to the next page. So my preview doesn't work correct. How can I do something like a preloading, so that my other subview pages are loaded before I switch to them?
Thanks for your help, I hope I could explain it that its clear... Andy
Code:
XIB: I have got one UIScrollView, Size 750, 700. My Customview is 700,700.
resultScrollView.clipsToBounds = NO;
resultScrollView.pagingEnabled = YES;
resultScrollView.showsHorizontalScrollIndicator = YES;
[resultScrollView addSubview:[self createCustomSubView:0.0f :VIEW_OFFSET_BETWEEN :VIEW_WIDTH :VIEW_HEIGHT]];
[resultScrollView addSubview:[self createCustomSubView.frame.size.width :VIEW_OFFSET_BETWEEN :VIEW_WIDTH :VIEW_HEIGHT]];
[resultScrollView addSubview:[self createCustomSubView:2*resultScrollView.frame.size.width :VIEW_OFFSET_BETWEEN :VIEW_WIDTH :VIEW_HEIGHT]];
[resultScrollView addSubview:[self createCustomSubView:3*resultScrollView.frame.size.width :VIEW_OFFSET_BETWEEN :VIEW_WIDTH :VIEW_HEIGHT]];
[resultScrollView addSubview:[self createCustomSubView:4*resultScrollView.frame.size.width :VIEW_OFFSET_BETWEEN :VIEW_WIDTH :VIEW_HEIGHT]];
resultScrollView.contentSize = CGSizeMake(5*resultScrollView.frame.size.width+5*VIEW_OFFSET_BETWEEN, resultScrollView.frame.size.height);
The method:
CGRect frame = CGRectMake(contentOffset + betweenOffset, 0.0f, width, height);
NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"CustomSubview" owner:self options:nil];
CustomSubview *customSubView = [subviewArray objectAtIndex:0];
CustomSubview.frame = frame;
CustomSubview.contentMode = UIViewContentModeCenter;
CustomSubview.contentSize = CGSizeMake(VIEW_SCROLLABLE_CONTENT_WIDTH, VIEW_SCROLLABLE_CONTENT_HEIGHT);