Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bottom view allows for right and left scroll #11

Open
zalsaeed opened this issue Dec 27, 2016 · 1 comment
Open

Bottom view allows for right and left scroll #11

zalsaeed opened this issue Dec 27, 2016 · 1 comment

Comments

@zalsaeed
Copy link

I think this qualifies to be a bug. However, since I have heavily changed the original code there is a possibility that I have introduce something caused the problem.

In the VericalScrollViewController class the method outerScrollViewShouldScroll if I understand this correctly is responsible of disabling the horizontal scrolling on the outer vertical views (top and bottom). The method works fine for the top view since the condition scrollView.contentOffset.y < middleVc.view.frame.origin.y will catch anything that is placed to the top of the the middle (main) view. However, when it comes to the bottom one the condition scrollView.contentOffset.y > 2*middleVc.view.frame.origin.y is not accurate since it slightly exclude the bottom view. For example, if we arbitrarily assume that the y origin value for the main view is 6 and its height is 6 as well, then the y origin value for the bottom view would be 12. Given the condition 12 is equal to 2*6 thus the horizontal scrolling is enabled and one can go from the bottom view to the right and left ones. I think the safest is to change the conditional scrollView.contentOffset.y > 2*middleVc.view.frame.origin.y to scrollView.contentOffset.y > middleVc.view.frame.origin.y. Also, I think it is possible to change the whole condition to if scrollView.contentOffset.y != middleVc.view.frame.origin.y {return false} but I don't know if this will introduce navigation difficulties due to high accuracy.

Finally, thanks for sharing this.

@fatmaakcay
Copy link

Yes, this bug is present in the original code. your first suggestion, to change scrollView.contentOffset.y > 2*middleVc.view.frame.origin.y to scrollView.contentOffset.y > middleVc.view.frame.origin.y works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants