Hello guys!
I have 3 UIScrollView. Here is a sample code, about how they are added in eachother:
UIScrollView main;
UIScrollView page1;
UIScrollView page2;
UIScrollView doublePage;
UIView pageContent1;
UIView pageContent2;
UIView doublePageContent;
int nrPages = 1;
sw2 = 0;
main = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 768, 980)];
main.contentSize = CGSizeMake(768 * (nrPages - 1 + sw2), 980);
page1.frame = CGRectMake(0, 0, 768, 980);
page2.frame = CGRectMake(768, 0, 768, 980);
pageNumber = i - 1 + sw2; (i is a variable in a for loop)
doublePage.frame = CGRectMake(768 * (pageNumber - 1), 0, 768 * 2, 980);
CGFloat contentWidth = [page1 bounds].size.width + [page2 bounds].size.width;
CGFloat contentHeight = page1 ? self.page1.bounds.size.height : self.page2.bounds.size.height;
doublePageContent = [[UIView alloc] initWithFrame:CGRectMake(0, 0, contentWidth, contentHeight)];
[page1 addSubview:pageContent1];
[page2 addSubview:pageContent2];
[doublePageContent addSubview:page1];
[doublePageContent addSubview:page2];
[doublePage addSubview:doublePageContent];
[main addSubview:doublepage];
And with this structure the main scrollview don't want to scroll. Without the doublepage scrollview it is working good. What do you think? What's the problem?
I know this structure is a little weird, but I need this structure because other parts of the code.
Edited, added the information about the sizes. If you need something more please tell me.
And one more thing.. If I add 1 pixel to the width of the doublePage contentSize.width it scrolls, but a bit hard, so it scrolls first in the doublePage and then in the main.