Hi, guys!
I have a question about nested scroll view.
There is a scroll view containing nested scroll views. I will just call outer-scrollview and inner-scrollview. outer-scrollview is horizontal scrollview, and inner-scrollviews are vertical-scrollview.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_outerScrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
_outerScrollView.pagingEnabled = YES;
_outerScrollView.contentSize = CGSizeMake(_outerScrollView.frame.size.width * 3, _outerScrollView.frame.size.height);
[self.view addSubview:_outerScrollView];
for(int i=0; i<3; i++) {
UIScrollView *innerScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(i * _outerScrollView.frame.size.width,
0,
_outerScrollView.frame.size.width,
_outerScrollView.frame.size.height)];
[_outerScrollView addSubview:innerScrollView];
UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, innerScrollView.frame.size.width, innerScrollView.frame.size.height * 2.0)];
contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"imagefile"]];
[innerScrollView addSubview:contentView];
innerScrollView.contentSize = contentView.frame.size;
}
}
Basically, if only 1 scroll view will be scrolled at the same time.
If I scroll to left or right, then outer-scrollview will be scrolled.
If I scroll to top or bottom, then inner-scrollview will be scrolled,
AND, if I scroll diagonally, one of both will be scrolled. It is depend on the direction of the scrolling.
If the angle is 0~45 degree, inner-scrollview will be scrolled. If the angle is 45~90 degree, outer-scrollview will be scrolled.
Is it possible to change the ANGLE?
For example, even though the angle is 30 degree, I want to scroll horizontally.
Thank you!
Any help would be appreciated :)