Is it possible to make the effect that :
when I scroll an UITableView, another UITableView auto-scrolls simultaneously according to the UITableView I am moving.
NS: Can't combine the two UITableViews in one UITableView for some reasons...
Thanks.
I have found a way and tested. Just I am not sure if it is a good way. Perform scrollViewDidScroll of UIScrollViewDelegate like the follows. But I have to uncheck bouncing effect since it makes the scrollViewDidScroll being called for many times for one scroll...
- (void)syncTableViews:(UIScrollView *)whatScrollView
{
int tmpDesY = whatScrollView.contentOffset.y;
BOOL tmpNeedSetTv00 = NO;
BOOL tmpNeedSetTv01 = NO;
BOOL tmpNeedSetTv02 = NO;
if(whatScrollView == self.TableView00)
{
tmpNeedSetTv01 = YES;
tmpNeedSetTv02 = YES;
}
else if(whatScrollView == self.TableView01)
{
tmpNeedSetTv00 = YES;
tmpNeedSetTv02 = YES;
}
else if(whatScrollView == self.TableView02)
{
tmpNeedSetTv00 = YES;
tmpNeedSetTv01 = YES;
}
if(tmpNeedSetTv00 == YES)
{
[self.TableView00 setContentOffset:CGPointMake(self.TableView00.contentOffset.x,tmpDesY) animated:NO];
}
if(tmpNeedSetTv01 == YES)
{
[self.TableView01 setContentOffset:CGPointMake(self.TableView01.contentOffset.x,tmpDesY) animated:NO];
}
if(tmpNeedSetTv02 == YES)
{
[self.TableView02 setContentOffset:CGPointMake(self.TableView02.contentOffset.x, tmpDesY) animated:NO];
}
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self syncTableViews:scrollView];
}