I want to make two tables on single screen, so that if Table A is scrolled down render Table B simultaneously scrolling up. Can someone code it or provide me any easy way to do that.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As Wubao mentioned, you have to use the
UIScrollViewDelegate. But you have to check, which scrollView is dragging / active at the moment. Because else you will have the problem that you will get delegate callbacks from both scrollviews and they will give their change to each other at the same time resulting in an endless loop / in endless scrolling.In detail, you have to check:
- (void)scrollViewDidScroll:(UIScrollView *)scrollViewBut you have to remember the previous offset, so you do know the change of the value.
(Or your views have the same height. Then you could just use
contentSize.height-offsetas the offset for the other view.I’ll try to write it down a little bit (untested):
Thats it basically. It also locks the not active scrollview. Because scrolling both would result in ugly behaviour. Also
contentOffset.y += changeLeft;wont work probably. You have to create a new CGPoint/CGSize.