I had three UITableView
s contained in one UIScrollView
(pagingEnable = YES
),
The hierarchy looks like:
+--visible area--+ ---+
+---------`UIScrollView`---------+---------------+| --+|
| +-------------+ +-------------+|+-------------+|| -+||
| | 0 | | 1 ||| 2 ||| |||
| |`UITableView`| |`UITableView`|||`UITableView`||| equal height
| | | | ||| ||| |||
| +-------------+ +-------------+|+-------------+|| -+||
+--------------------------------+---------------+| --+|
+----------------+ ---+
The UIScrollView
(as container view) had it'scontentSize.height
set to fit the screen height, thus it's only scrollable in horizontal direction.
And each UITableView
is vertically scrollable as is.
The problem is I have no idea which view (ScrollView
or TableView
) handle a current finger touch on the screen.
It works fine when I scroll a perfect vertical / horizontal path through the screen to move the ScrollView
or TableView
.
While if I scroll from the bottom right to the top left (like a backslash "\") it sometimes move the ScrollView horizontally, sometimes move the TableView vertically...even worse it move none of both but just shake the TableView
ridiculously. I just can't move what I expected.
I assume it's because UIScrollView
and UITableView
's ScrollView have detection conflict .
Here I added log to the UIScrollViewDelegate method:
//in each ViewController handle a UITableView
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
NSLog(@"TableView touched")
}
}
//in the ViewController handle the UIScrollView
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
NSLog(@"ScrollView touched")
}
}
//as a side note...I set three ViewControllers(each holds one TableView) into a ContainerViewController(holds ScrollView)
They logged out one after another randomly...but almost the same time.
Any idea would be appreciated!